Commit 620b3a0

mo khan <mo@mokhan.ca>
2024-06-05 18:26:37
Start to define a storage interface for saving each issue
1 parent 5ee7e97
Changed files (2)
cmd
stanuki
pkg
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)
 	})
 }
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
+}