/
runtime.go
115 lines (111 loc) · 6.86 KB
/
runtime.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// Code generated by ent, DO NOT EDIT.
package ent
import (
"time"
"github.com/google/uuid"
"github.com/interngowhere/web-backend/ent/comment"
"github.com/interngowhere/web-backend/ent/schema"
"github.com/interngowhere/web-backend/ent/tag"
"github.com/interngowhere/web-backend/ent/thread"
"github.com/interngowhere/web-backend/ent/topic"
"github.com/interngowhere/web-backend/ent/user"
)
// The init function reads all schema descriptors with runtime code
// (default values, validators, hooks and policies) and stitches it
// to their package variables.
func init() {
commentFields := schema.Comment{}.Fields()
_ = commentFields
// commentDescParentID is the schema descriptor for parent_id field.
commentDescParentID := commentFields[0].Descriptor()
// comment.DefaultParentID holds the default value on creation for the parent_id field.
comment.DefaultParentID = commentDescParentID.Default.(int)
// commentDescContent is the schema descriptor for content field.
commentDescContent := commentFields[1].Descriptor()
// comment.ContentValidator is a validator for the "content" field. It is called by the builders before save.
comment.ContentValidator = commentDescContent.Validators[0].(func(string) error)
// commentDescCreatedAt is the schema descriptor for created_at field.
commentDescCreatedAt := commentFields[4].Descriptor()
// comment.DefaultCreatedAt holds the default value on creation for the created_at field.
comment.DefaultCreatedAt = commentDescCreatedAt.Default.(time.Time)
tagFields := schema.Tag{}.Fields()
_ = tagFields
// tagDescTagName is the schema descriptor for tag_name field.
tagDescTagName := tagFields[0].Descriptor()
// tag.TagNameValidator is a validator for the "tag_name" field. It is called by the builders before save.
tag.TagNameValidator = tagDescTagName.Validators[0].(func(string) error)
threadFields := schema.Thread{}.Fields()
_ = threadFields
// threadDescTitle is the schema descriptor for title field.
threadDescTitle := threadFields[0].Descriptor()
// thread.TitleValidator is a validator for the "title" field. It is called by the builders before save.
thread.TitleValidator = threadDescTitle.Validators[0].(func(string) error)
// threadDescSlug is the schema descriptor for slug field.
threadDescSlug := threadFields[1].Descriptor()
// thread.SlugValidator is a validator for the "slug" field. It is called by the builders before save.
thread.SlugValidator = threadDescSlug.Validators[0].(func(string) error)
// threadDescDescription is the schema descriptor for description field.
threadDescDescription := threadFields[2].Descriptor()
// thread.DescriptionValidator is a validator for the "description" field. It is called by the builders before save.
thread.DescriptionValidator = threadDescDescription.Validators[0].(func(string) error)
// threadDescCreatedAt is the schema descriptor for created_at field.
threadDescCreatedAt := threadFields[5].Descriptor()
// thread.DefaultCreatedAt holds the default value on creation for the created_at field.
thread.DefaultCreatedAt = threadDescCreatedAt.Default.(time.Time)
topicFields := schema.Topic{}.Fields()
_ = topicFields
// topicDescTitle is the schema descriptor for title field.
topicDescTitle := topicFields[0].Descriptor()
// topic.TitleValidator is a validator for the "title" field. It is called by the builders before save.
topic.TitleValidator = topicDescTitle.Validators[0].(func(string) error)
// topicDescSlug is the schema descriptor for slug field.
topicDescSlug := topicFields[1].Descriptor()
// topic.SlugValidator is a validator for the "slug" field. It is called by the builders before save.
topic.SlugValidator = topicDescSlug.Validators[0].(func(string) error)
// topicDescShortDescription is the schema descriptor for short_description field.
topicDescShortDescription := topicFields[2].Descriptor()
// topic.ShortDescriptionValidator is a validator for the "short_description" field. It is called by the builders before save.
topic.ShortDescriptionValidator = topicDescShortDescription.Validators[0].(func(string) error)
// topicDescDescription is the schema descriptor for description field.
topicDescDescription := topicFields[3].Descriptor()
// topic.DescriptionValidator is a validator for the "description" field. It is called by the builders before save.
topic.DescriptionValidator = topicDescDescription.Validators[0].(func(string) error)
// topicDescCreatedAt is the schema descriptor for created_at field.
topicDescCreatedAt := topicFields[5].Descriptor()
// topic.DefaultCreatedAt holds the default value on creation for the created_at field.
topic.DefaultCreatedAt = topicDescCreatedAt.Default.(time.Time)
userFields := schema.User{}.Fields()
_ = userFields
// userDescEmail is the schema descriptor for email field.
userDescEmail := userFields[1].Descriptor()
// user.EmailValidator is a validator for the "email" field. It is called by the builders before save.
user.EmailValidator = userDescEmail.Validators[0].(func(string) error)
// userDescUsername is the schema descriptor for username field.
userDescUsername := userFields[2].Descriptor()
// user.UsernameValidator is a validator for the "username" field. It is called by the builders before save.
user.UsernameValidator = userDescUsername.Validators[0].(func(string) error)
// userDescFirstName is the schema descriptor for first_name field.
userDescFirstName := userFields[3].Descriptor()
// user.FirstNameValidator is a validator for the "first_name" field. It is called by the builders before save.
user.FirstNameValidator = userDescFirstName.Validators[0].(func(string) error)
// userDescLastName is the schema descriptor for last_name field.
userDescLastName := userFields[4].Descriptor()
// user.LastNameValidator is a validator for the "last_name" field. It is called by the builders before save.
user.LastNameValidator = userDescLastName.Validators[0].(func(string) error)
// userDescHash is the schema descriptor for hash field.
userDescHash := userFields[5].Descriptor()
// user.HashValidator is a validator for the "hash" field. It is called by the builders before save.
user.HashValidator = userDescHash.Validators[0].(func([]byte) error)
// userDescEmailVerified is the schema descriptor for email_verified field.
userDescEmailVerified := userFields[6].Descriptor()
// user.DefaultEmailVerified holds the default value on creation for the email_verified field.
user.DefaultEmailVerified = userDescEmailVerified.Default.(bool)
// userDescCreatedAt is the schema descriptor for created_at field.
userDescCreatedAt := userFields[7].Descriptor()
// user.DefaultCreatedAt holds the default value on creation for the created_at field.
user.DefaultCreatedAt = userDescCreatedAt.Default.(time.Time)
// userDescID is the schema descriptor for id field.
userDescID := userFields[0].Descriptor()
// user.DefaultID holds the default value on creation for the id field.
user.DefaultID = userDescID.Default.(func() uuid.UUID)
}