diff options
| author | mo khan <mo@mokhan.ca> | 2024-06-05 12:26:37 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2024-06-05 12:26:37 -0600 |
| commit | 620b3a0be81070872c8c990a1aecdc0e661dc90e (patch) | |
| tree | 9d735c06b54a48607fe28cfbf35b161a30647244 | |
| parent | 5ee7e972f659afb951944873de024f88c1d1b149 (diff) | |
Start to define a storage interface for saving each issue
| -rw-r--r-- | cmd/stanuki/main.go | 4 | ||||
| -rw-r--r-- | pkg/db/client.go | 15 |
2 files changed, 18 insertions, 1 deletions
diff --git a/cmd/stanuki/main.go b/cmd/stanuki/main.go index 9b4fca3..0588809 100644 --- a/cmd/stanuki/main.go +++ b/cmd/stanuki/main.go @@ -5,13 +5,15 @@ import ( "fmt" "github.com/xlgmokha/x/pkg/env" + "gitlab.com/mokhax/stanuki/pkg/db" "gitlab.com/mokhax/stanuki/pkg/gitlab" ) func main() { + issues := db.New[*gitlab.Issue]("./db/issues") gl := gitlab.New(context.TODO(), env.Fetch("GITLAB_TOKEN", "")) - gl.Group(9970).EachIssue(func(issue *gitlab.Issue) { fmt.Printf("%v: %v\n", issue.ID, issue.Title) + issues.Save(issue) }) } diff --git a/pkg/db/client.go b/pkg/db/client.go new file mode 100644 index 0000000..39d3f9e --- /dev/null +++ b/pkg/db/client.go @@ -0,0 +1,15 @@ +package db + +type Storage[T any] struct { + dir string +} + +func New[T any](dir string) *Storage[T] { + return &Storage[T]{ + dir: dir, + } +} + +func (db *Storage[T]) Save(item T) error { + return nil +} |
