entgo의 공식 문서를 요약한 치트 시트

초기 세팅

go get entgo.io/ent/cmd/ent
go mod init <project>
go run entgo.io/ent/cmd/ent init <table name>

파일 구조

package schema

// User holds the schema definition for the User entity.
type User struct {
    ent.Schema
}

// Fields of the User.
func (User) Fields() []ent.Field {
    return nil
}

// Edges of the User.
func (User) Edges() []ent.Edge {
    return nil
}

필드 속성

comments powered by Disqus