| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306 |
- // Code generated by ent, DO NOT EDIT.
- package usersubscription
- import (
- "time"
- "entgo.io/ent"
- "entgo.io/ent/dialect/sql"
- "entgo.io/ent/dialect/sql/sqlgraph"
- )
- const (
- // Label holds the string label denoting the usersubscription type in the database.
- Label = "user_subscription"
- // FieldID holds the string denoting the id field in the database.
- FieldID = "id"
- // FieldCreatedAt holds the string denoting the created_at field in the database.
- FieldCreatedAt = "created_at"
- // FieldUpdatedAt holds the string denoting the updated_at field in the database.
- FieldUpdatedAt = "updated_at"
- // FieldDeletedAt holds the string denoting the deleted_at field in the database.
- FieldDeletedAt = "deleted_at"
- // FieldUserID holds the string denoting the user_id field in the database.
- FieldUserID = "user_id"
- // FieldGroupID holds the string denoting the group_id field in the database.
- FieldGroupID = "group_id"
- // FieldStartsAt holds the string denoting the starts_at field in the database.
- FieldStartsAt = "starts_at"
- // FieldExpiresAt holds the string denoting the expires_at field in the database.
- FieldExpiresAt = "expires_at"
- // FieldStatus holds the string denoting the status field in the database.
- FieldStatus = "status"
- // FieldDailyWindowStart holds the string denoting the daily_window_start field in the database.
- FieldDailyWindowStart = "daily_window_start"
- // FieldWeeklyWindowStart holds the string denoting the weekly_window_start field in the database.
- FieldWeeklyWindowStart = "weekly_window_start"
- // FieldMonthlyWindowStart holds the string denoting the monthly_window_start field in the database.
- FieldMonthlyWindowStart = "monthly_window_start"
- // FieldDailyUsageUsd holds the string denoting the daily_usage_usd field in the database.
- FieldDailyUsageUsd = "daily_usage_usd"
- // FieldWeeklyUsageUsd holds the string denoting the weekly_usage_usd field in the database.
- FieldWeeklyUsageUsd = "weekly_usage_usd"
- // FieldMonthlyUsageUsd holds the string denoting the monthly_usage_usd field in the database.
- FieldMonthlyUsageUsd = "monthly_usage_usd"
- // FieldAssignedBy holds the string denoting the assigned_by field in the database.
- FieldAssignedBy = "assigned_by"
- // FieldAssignedAt holds the string denoting the assigned_at field in the database.
- FieldAssignedAt = "assigned_at"
- // FieldNotes holds the string denoting the notes field in the database.
- FieldNotes = "notes"
- // EdgeUser holds the string denoting the user edge name in mutations.
- EdgeUser = "user"
- // EdgeGroup holds the string denoting the group edge name in mutations.
- EdgeGroup = "group"
- // EdgeAssignedByUser holds the string denoting the assigned_by_user edge name in mutations.
- EdgeAssignedByUser = "assigned_by_user"
- // EdgeUsageLogs holds the string denoting the usage_logs edge name in mutations.
- EdgeUsageLogs = "usage_logs"
- // Table holds the table name of the usersubscription in the database.
- Table = "user_subscriptions"
- // UserTable is the table that holds the user relation/edge.
- UserTable = "user_subscriptions"
- // 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"
- // GroupTable is the table that holds the group relation/edge.
- GroupTable = "user_subscriptions"
- // GroupInverseTable is the table name for the Group entity.
- // It exists in this package in order to avoid circular dependency with the "group" package.
- GroupInverseTable = "groups"
- // GroupColumn is the table column denoting the group relation/edge.
- GroupColumn = "group_id"
- // AssignedByUserTable is the table that holds the assigned_by_user relation/edge.
- AssignedByUserTable = "user_subscriptions"
- // AssignedByUserInverseTable is the table name for the User entity.
- // It exists in this package in order to avoid circular dependency with the "user" package.
- AssignedByUserInverseTable = "users"
- // AssignedByUserColumn is the table column denoting the assigned_by_user relation/edge.
- AssignedByUserColumn = "assigned_by"
- // UsageLogsTable is the table that holds the usage_logs relation/edge.
- UsageLogsTable = "usage_logs"
- // UsageLogsInverseTable is the table name for the UsageLog entity.
- // It exists in this package in order to avoid circular dependency with the "usagelog" package.
- UsageLogsInverseTable = "usage_logs"
- // UsageLogsColumn is the table column denoting the usage_logs relation/edge.
- UsageLogsColumn = "subscription_id"
- )
- // Columns holds all SQL columns for usersubscription fields.
- var Columns = []string{
- FieldID,
- FieldCreatedAt,
- FieldUpdatedAt,
- FieldDeletedAt,
- FieldUserID,
- FieldGroupID,
- FieldStartsAt,
- FieldExpiresAt,
- FieldStatus,
- FieldDailyWindowStart,
- FieldWeeklyWindowStart,
- FieldMonthlyWindowStart,
- FieldDailyUsageUsd,
- FieldWeeklyUsageUsd,
- FieldMonthlyUsageUsd,
- FieldAssignedBy,
- FieldAssignedAt,
- FieldNotes,
- }
- // 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
- }
- // Note that the variables below are initialized by the runtime
- // package on the initialization of the application. Therefore,
- // it should be imported in the main as follows:
- //
- // import _ "github.com/Wei-Shaw/sub2api/ent/runtime"
- var (
- Hooks [1]ent.Hook
- Interceptors [1]ent.Interceptor
- // DefaultCreatedAt holds the default value on creation for the "created_at" field.
- DefaultCreatedAt func() time.Time
- // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
- DefaultUpdatedAt func() time.Time
- // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
- UpdateDefaultUpdatedAt func() time.Time
- // DefaultStatus holds the default value on creation for the "status" field.
- DefaultStatus string
- // StatusValidator is a validator for the "status" field. It is called by the builders before save.
- StatusValidator func(string) error
- // DefaultDailyUsageUsd holds the default value on creation for the "daily_usage_usd" field.
- DefaultDailyUsageUsd float64
- // DefaultWeeklyUsageUsd holds the default value on creation for the "weekly_usage_usd" field.
- DefaultWeeklyUsageUsd float64
- // DefaultMonthlyUsageUsd holds the default value on creation for the "monthly_usage_usd" field.
- DefaultMonthlyUsageUsd float64
- // DefaultAssignedAt holds the default value on creation for the "assigned_at" field.
- DefaultAssignedAt func() time.Time
- )
- // OrderOption defines the ordering options for the UserSubscription 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()
- }
- // ByCreatedAt orders the results by the created_at field.
- func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
- }
- // ByUpdatedAt orders the results by the updated_at field.
- func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
- }
- // ByDeletedAt orders the results by the deleted_at field.
- func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
- }
- // ByUserID orders the results by the user_id field.
- func ByUserID(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldUserID, opts...).ToFunc()
- }
- // ByGroupID orders the results by the group_id field.
- func ByGroupID(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldGroupID, opts...).ToFunc()
- }
- // ByStartsAt orders the results by the starts_at field.
- func ByStartsAt(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldStartsAt, opts...).ToFunc()
- }
- // ByExpiresAt orders the results by the expires_at field.
- func ByExpiresAt(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldExpiresAt, opts...).ToFunc()
- }
- // ByStatus orders the results by the status field.
- func ByStatus(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldStatus, opts...).ToFunc()
- }
- // ByDailyWindowStart orders the results by the daily_window_start field.
- func ByDailyWindowStart(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldDailyWindowStart, opts...).ToFunc()
- }
- // ByWeeklyWindowStart orders the results by the weekly_window_start field.
- func ByWeeklyWindowStart(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldWeeklyWindowStart, opts...).ToFunc()
- }
- // ByMonthlyWindowStart orders the results by the monthly_window_start field.
- func ByMonthlyWindowStart(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldMonthlyWindowStart, opts...).ToFunc()
- }
- // ByDailyUsageUsd orders the results by the daily_usage_usd field.
- func ByDailyUsageUsd(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldDailyUsageUsd, opts...).ToFunc()
- }
- // ByWeeklyUsageUsd orders the results by the weekly_usage_usd field.
- func ByWeeklyUsageUsd(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldWeeklyUsageUsd, opts...).ToFunc()
- }
- // ByMonthlyUsageUsd orders the results by the monthly_usage_usd field.
- func ByMonthlyUsageUsd(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldMonthlyUsageUsd, opts...).ToFunc()
- }
- // ByAssignedBy orders the results by the assigned_by field.
- func ByAssignedBy(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldAssignedBy, opts...).ToFunc()
- }
- // ByAssignedAt orders the results by the assigned_at field.
- func ByAssignedAt(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldAssignedAt, opts...).ToFunc()
- }
- // ByNotes orders the results by the notes field.
- func ByNotes(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldNotes, opts...).ToFunc()
- }
- // 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...))
- }
- }
- // ByGroupField orders the results by group field.
- func ByGroupField(field string, opts ...sql.OrderTermOption) OrderOption {
- return func(s *sql.Selector) {
- sqlgraph.OrderByNeighborTerms(s, newGroupStep(), sql.OrderByField(field, opts...))
- }
- }
- // ByAssignedByUserField orders the results by assigned_by_user field.
- func ByAssignedByUserField(field string, opts ...sql.OrderTermOption) OrderOption {
- return func(s *sql.Selector) {
- sqlgraph.OrderByNeighborTerms(s, newAssignedByUserStep(), sql.OrderByField(field, opts...))
- }
- }
- // ByUsageLogsCount orders the results by usage_logs count.
- func ByUsageLogsCount(opts ...sql.OrderTermOption) OrderOption {
- return func(s *sql.Selector) {
- sqlgraph.OrderByNeighborsCount(s, newUsageLogsStep(), opts...)
- }
- }
- // ByUsageLogs orders the results by usage_logs terms.
- func ByUsageLogs(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
- return func(s *sql.Selector) {
- sqlgraph.OrderByNeighborTerms(s, newUsageLogsStep(), append([]sql.OrderTerm{term}, terms...)...)
- }
- }
- func newUserStep() *sqlgraph.Step {
- return sqlgraph.NewStep(
- sqlgraph.From(Table, FieldID),
- sqlgraph.To(UserInverseTable, FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, UserTable, UserColumn),
- )
- }
- func newGroupStep() *sqlgraph.Step {
- return sqlgraph.NewStep(
- sqlgraph.From(Table, FieldID),
- sqlgraph.To(GroupInverseTable, FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, GroupTable, GroupColumn),
- )
- }
- func newAssignedByUserStep() *sqlgraph.Step {
- return sqlgraph.NewStep(
- sqlgraph.From(Table, FieldID),
- sqlgraph.To(AssignedByUserInverseTable, FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, AssignedByUserTable, AssignedByUserColumn),
- )
- }
- func newUsageLogsStep() *sqlgraph.Step {
- return sqlgraph.NewStep(
- sqlgraph.From(Table, FieldID),
- sqlgraph.To(UsageLogsInverseTable, FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, UsageLogsTable, UsageLogsColumn),
- )
- }
|