mirror of
https://github.com/wisplite/tether.git
synced 2026-05-01 06:22:41 -05:00
added example program for testing
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/glebarez/sqlite"
|
||||
"github.com/wisplite/tether"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func main() {
|
||||
db, err := gorm.Open(sqlite.Open("test.db"), &gorm.Config{})
|
||||
if err != nil {
|
||||
panic("failed to connect database")
|
||||
}
|
||||
|
||||
engine := tether.NewEngine(db)
|
||||
|
||||
engine.RegisterMutation("createUser", func(ctx *tether.MutationCtx) error {
|
||||
return nil
|
||||
})
|
||||
|
||||
engine.RegisterQuery("getUser", func(ctx *tether.QueryCtx) error {
|
||||
return nil
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user