forked from fenos/dqlx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerator_test.go
41 lines (33 loc) · 875 Bytes
/
generator_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package dqlx_test
import (
"testing"
dql "github.com/fenos/dqlx"
"github.com/stretchr/testify/require"
)
func TestGenerateTypes(t *testing.T) {
t.Skipf("Working Progress")
schema := dql.NewSchema()
schema.Type("User", func(user *dql.TypeBuilder) {
user.String("name")
user.String("surname")
user.DateTime("birthday")
user.Password("password")
})
schema.Type("Tag", func(tag *dql.TypeBuilder) {
tag.String("name")
tag.Type("posts", "Post").Reverse()
})
schema.Type("Post", func(post *dql.TypeBuilder) {
post.String("title").Lang()
post.String("content")
post.Bool("published")
post.DateTime("created_at")
post.Type("tags", "Tag").Reverse().List()
post.Int("views")
})
err := dql.GenerateTypes(schema, dql.GeneratorOption{
Path: "C:\\Users\\fabri\\go\\src\\dqlx\\t.go",
PackageName: "dqlx",
})
require.NoError(t, err)
}