package main import ( "database/sql" "fmt" synchronizator "git.alecodes.page/alecodes/synchronizator/pkg" _ "modernc.org/sqlite" ) type ProgrammingLanguage struct { Name string } type Library struct { Version string `json:"version"` } type ( BelognsTo struct{} IsSame struct{} ) func main() { connection, err := sql.Open("sqlite", "db.sql") if err != nil { fmt.Println(err) return } defer connection.Close() opts := synchronizator.DefaultOptions opts.Log_level = synchronizator.DEBUG opts.DANGEROUSLY_DROP_TABLES = true sync, err := synchronizator.New(connection, opts) if err != nil { fmt.Println(err) return } sync.RegisterNodeClass(Library{}) // collection, err := sync.NewCollection(ProgrammingLanguage{Name: "foo"}) express, err := sync.NewNode("ExpressJS", Library{Version: "v22"}) flask, err := sync.NewNode("Flask", Library{Version: "v22"}) relation, err := sync.AddRelation(express.Id, BelognsTo{}, flask.Id) // relation, err := express.AddRelation(BelognsTo{}, flask.Id) // node, err := sync.GetNode(1) if err != nil { fmt.Println(err) return } // fmt.Printf("\n%+v\n", collection) fmt.Printf("\n%+v\n", express) fmt.Printf("\n%+v\n", flask) fmt.Printf("\n%+v\n", relation) }