setting.go 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // Code generated by ent, DO NOT EDIT.
  2. package setting
  3. import (
  4. "time"
  5. "entgo.io/ent/dialect/sql"
  6. )
  7. const (
  8. // Label holds the string label denoting the setting type in the database.
  9. Label = "setting"
  10. // FieldID holds the string denoting the id field in the database.
  11. FieldID = "id"
  12. // FieldKey holds the string denoting the key field in the database.
  13. FieldKey = "key"
  14. // FieldValue holds the string denoting the value field in the database.
  15. FieldValue = "value"
  16. // FieldUpdatedAt holds the string denoting the updated_at field in the database.
  17. FieldUpdatedAt = "updated_at"
  18. // Table holds the table name of the setting in the database.
  19. Table = "settings"
  20. )
  21. // Columns holds all SQL columns for setting fields.
  22. var Columns = []string{
  23. FieldID,
  24. FieldKey,
  25. FieldValue,
  26. FieldUpdatedAt,
  27. }
  28. // ValidColumn reports if the column name is valid (part of the table columns).
  29. func ValidColumn(column string) bool {
  30. for i := range Columns {
  31. if column == Columns[i] {
  32. return true
  33. }
  34. }
  35. return false
  36. }
  37. var (
  38. // KeyValidator is a validator for the "key" field. It is called by the builders before save.
  39. KeyValidator func(string) error
  40. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  41. DefaultUpdatedAt func() time.Time
  42. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  43. UpdateDefaultUpdatedAt func() time.Time
  44. )
  45. // OrderOption defines the ordering options for the Setting queries.
  46. type OrderOption func(*sql.Selector)
  47. // ByID orders the results by the id field.
  48. func ByID(opts ...sql.OrderTermOption) OrderOption {
  49. return sql.OrderByField(FieldID, opts...).ToFunc()
  50. }
  51. // ByKey orders the results by the key field.
  52. func ByKey(opts ...sql.OrderTermOption) OrderOption {
  53. return sql.OrderByField(FieldKey, opts...).ToFunc()
  54. }
  55. // ByValue orders the results by the value field.
  56. func ByValue(opts ...sql.OrderTermOption) OrderOption {
  57. return sql.OrderByField(FieldValue, opts...).ToFunc()
  58. }
  59. // ByUpdatedAt orders the results by the updated_at field.
  60. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  61. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  62. }