| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- // Code generated by ent, DO NOT EDIT.
- package announcementread
- import (
- "time"
- "entgo.io/ent/dialect/sql"
- "entgo.io/ent/dialect/sql/sqlgraph"
- )
- const (
- // Label holds the string label denoting the announcementread type in the database.
- Label = "announcement_read"
- // FieldID holds the string denoting the id field in the database.
- FieldID = "id"
- // FieldAnnouncementID holds the string denoting the announcement_id field in the database.
- FieldAnnouncementID = "announcement_id"
- // FieldUserID holds the string denoting the user_id field in the database.
- FieldUserID = "user_id"
- // FieldReadAt holds the string denoting the read_at field in the database.
- FieldReadAt = "read_at"
- // FieldCreatedAt holds the string denoting the created_at field in the database.
- FieldCreatedAt = "created_at"
- // EdgeAnnouncement holds the string denoting the announcement edge name in mutations.
- EdgeAnnouncement = "announcement"
- // EdgeUser holds the string denoting the user edge name in mutations.
- EdgeUser = "user"
- // Table holds the table name of the announcementread in the database.
- Table = "announcement_reads"
- // AnnouncementTable is the table that holds the announcement relation/edge.
- AnnouncementTable = "announcement_reads"
- // AnnouncementInverseTable is the table name for the Announcement entity.
- // It exists in this package in order to avoid circular dependency with the "announcement" package.
- AnnouncementInverseTable = "announcements"
- // AnnouncementColumn is the table column denoting the announcement relation/edge.
- AnnouncementColumn = "announcement_id"
- // UserTable is the table that holds the user relation/edge.
- UserTable = "announcement_reads"
- // UserInverseTable is the table name for the User entity.
- // It exists in this package in order to avoid circular dependency with the "user" package.
- UserInverseTable = "users"
- // UserColumn is the table column denoting the user relation/edge.
- UserColumn = "user_id"
- )
- // Columns holds all SQL columns for announcementread fields.
- var Columns = []string{
- FieldID,
- FieldAnnouncementID,
- FieldUserID,
- FieldReadAt,
- FieldCreatedAt,
- }
- // 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
- }
- }
- return false
- }
- var (
- // DefaultReadAt holds the default value on creation for the "read_at" field.
- DefaultReadAt func() time.Time
- // DefaultCreatedAt holds the default value on creation for the "created_at" field.
- DefaultCreatedAt func() time.Time
- )
- // OrderOption defines the ordering options for the AnnouncementRead queries.
- type OrderOption func(*sql.Selector)
- // ByID orders the results by the id field.
- func ByID(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldID, opts...).ToFunc()
- }
- // ByAnnouncementID orders the results by the announcement_id field.
- func ByAnnouncementID(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldAnnouncementID, opts...).ToFunc()
- }
- // ByUserID orders the results by the user_id field.
- func ByUserID(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldUserID, opts...).ToFunc()
- }
- // ByReadAt orders the results by the read_at field.
- func ByReadAt(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldReadAt, opts...).ToFunc()
- }
- // ByCreatedAt orders the results by the created_at field.
- func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
- }
- // ByAnnouncementField orders the results by announcement field.
- func ByAnnouncementField(field string, opts ...sql.OrderTermOption) OrderOption {
- return func(s *sql.Selector) {
- sqlgraph.OrderByNeighborTerms(s, newAnnouncementStep(), sql.OrderByField(field, opts...))
- }
- }
- // ByUserField orders the results by user field.
- func ByUserField(field string, opts ...sql.OrderTermOption) OrderOption {
- return func(s *sql.Selector) {
- sqlgraph.OrderByNeighborTerms(s, newUserStep(), sql.OrderByField(field, opts...))
- }
- }
- func newAnnouncementStep() *sqlgraph.Step {
- return sqlgraph.NewStep(
- sqlgraph.From(Table, FieldID),
- sqlgraph.To(AnnouncementInverseTable, FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, AnnouncementTable, AnnouncementColumn),
- )
- }
- func newUserStep() *sqlgraph.Step {
- return sqlgraph.NewStep(
- sqlgraph.From(Table, FieldID),
- sqlgraph.To(UserInverseTable, FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, UserTable, UserColumn),
- )
- }
|