// Code generated by entc, DO NOT EDIT. package todo import ( "fmt" "time" ) const ( // Label holds the string label denoting the todo type in the database. Label = "todo" // FieldID holds the string denoting the id field in the database. FieldID = "id" // FieldText holds the string denoting the text field in the database. FieldText = "text" // FieldCreatedAt holds the string denoting the created_at field in the database. FieldCreatedAt = "created_at" // FieldStatus holds the string denoting the status field in the database. FieldStatus = "status" // FieldPriority holds the string denoting the priority field in the database. FieldPriority = "priority" // EdgeChildren holds the string denoting the children edge name in mutations. EdgeChildren = "children" // EdgeParent holds the string denoting the parent edge name in mutations. EdgeParent = "parent" // Table holds the table name of the todo in the database. Table = "todos" // ChildrenTable is the table that holds the children relation/edge. ChildrenTable = "todos" // ChildrenColumn is the table column denoting the children relation/edge. ChildrenColumn = "todo_parent" // ParentTable is the table that holds the parent relation/edge. ParentTable = "todos" // ParentColumn is the table column denoting the parent relation/edge. ParentColumn = "todo_parent" ) // Columns holds all SQL columns for todo fields. var Columns = []string{ FieldID, FieldText, FieldCreatedAt, FieldStatus, FieldPriority, } // ForeignKeys holds the SQL foreign-keys that are owned by the "todos" // table and are not defined as standalone fields in the schema. var ForeignKeys = []string{ "todo_parent", } // ValidColumn reports if the column name is valid (part of the table columns). func ValidColumn(column string) bool { for i := range Columns { if column == Columns[i] { return true } } for i := range ForeignKeys { if column == ForeignKeys[i] { return true } } return false } var ( // TextValidator is a validator for the "text" field. It is called by the builders before save. TextValidator func(string) error // DefaultCreatedAt holds the default value on creation for the "created_at" field. DefaultCreatedAt func() time.Time // DefaultPriority holds the default value on creation for the "priority" field. DefaultPriority int ) // Status defines the type for the "status" enum field. type Status string // StatusInProgress is the default value of the Status enum. const DefaultStatus = StatusInProgress // Status values. const ( StatusInProgress Status = "in_progress" StatusCompleted Status = "completed" ) func (s Status) String() string { return string(s) } // StatusValidator is a validator for the "status" field enum values. It is called by the builders before save. func StatusValidator(s Status) error { switch s { case StatusInProgress, StatusCompleted: return nil default: return fmt.Errorf("todo: invalid enum value for status field: %q", s) } }