File size: 4,321 Bytes
8059bf0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
116
117
118
119
120
121
122
123
124
125
126
// Code generated by ent, DO NOT EDIT.

package promocodeusage

import (
	"time"

	"entgo.io/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
)

const (
	// Label holds the string label denoting the promocodeusage type in the database.
	Label = "promo_code_usage"
	// FieldID holds the string denoting the id field in the database.
	FieldID = "id"
	// FieldPromoCodeID holds the string denoting the promo_code_id field in the database.
	FieldPromoCodeID = "promo_code_id"
	// FieldUserID holds the string denoting the user_id field in the database.
	FieldUserID = "user_id"
	// FieldBonusAmount holds the string denoting the bonus_amount field in the database.
	FieldBonusAmount = "bonus_amount"
	// FieldUsedAt holds the string denoting the used_at field in the database.
	FieldUsedAt = "used_at"
	// EdgePromoCode holds the string denoting the promo_code edge name in mutations.
	EdgePromoCode = "promo_code"
	// EdgeUser holds the string denoting the user edge name in mutations.
	EdgeUser = "user"
	// Table holds the table name of the promocodeusage in the database.
	Table = "promo_code_usages"
	// PromoCodeTable is the table that holds the promo_code relation/edge.
	PromoCodeTable = "promo_code_usages"
	// PromoCodeInverseTable is the table name for the PromoCode entity.
	// It exists in this package in order to avoid circular dependency with the "promocode" package.
	PromoCodeInverseTable = "promo_codes"
	// PromoCodeColumn is the table column denoting the promo_code relation/edge.
	PromoCodeColumn = "promo_code_id"
	// UserTable is the table that holds the user relation/edge.
	UserTable = "promo_code_usages"
	// 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 promocodeusage fields.
var Columns = []string{
	FieldID,
	FieldPromoCodeID,
	FieldUserID,
	FieldBonusAmount,
	FieldUsedAt,
}

// 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 (
	// DefaultUsedAt holds the default value on creation for the "used_at" field.
	DefaultUsedAt func() time.Time
)

// OrderOption defines the ordering options for the PromoCodeUsage 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()
}

// ByPromoCodeID orders the results by the promo_code_id field.
func ByPromoCodeID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPromoCodeID, opts...).ToFunc()
}

// ByUserID orders the results by the user_id field.
func ByUserID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldUserID, opts...).ToFunc()
}

// ByBonusAmount orders the results by the bonus_amount field.
func ByBonusAmount(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldBonusAmount, opts...).ToFunc()
}

// ByUsedAt orders the results by the used_at field.
func ByUsedAt(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldUsedAt, opts...).ToFunc()
}

// ByPromoCodeField orders the results by promo_code field.
func ByPromoCodeField(field string, opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newPromoCodeStep(), 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 newPromoCodeStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(PromoCodeInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2O, true, PromoCodeTable, PromoCodeColumn),
	)
}
func newUserStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(UserInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2O, true, UserTable, UserColumn),
	)
}