agentbase.go 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. // Code generated by ent, DO NOT EDIT.
  2. package agentbase
  3. import (
  4. "entgo.io/ent/dialect/sql"
  5. "entgo.io/ent/dialect/sql/sqlgraph"
  6. )
  7. const (
  8. // Label holds the string label denoting the agentbase type in the database.
  9. Label = "agent_base"
  10. // FieldID holds the string denoting the id field in the database.
  11. FieldID = "id"
  12. // FieldQ holds the string denoting the q field in the database.
  13. FieldQ = "q"
  14. // FieldA holds the string denoting the a field in the database.
  15. FieldA = "a"
  16. // FieldChunkIndex holds the string denoting the chunk_index field in the database.
  17. FieldChunkIndex = "chunk_index"
  18. // FieldIndexes holds the string denoting the indexes field in the database.
  19. FieldIndexes = "indexes"
  20. // FieldDatasetID holds the string denoting the dataset_id field in the database.
  21. FieldDatasetID = "dataset_id"
  22. // FieldCollectionID holds the string denoting the collection_id field in the database.
  23. FieldCollectionID = "collection_id"
  24. // FieldSourceName holds the string denoting the source_name field in the database.
  25. FieldSourceName = "source_name"
  26. // FieldCanWrite holds the string denoting the can_write field in the database.
  27. FieldCanWrite = "can_write"
  28. // FieldIsOwner holds the string denoting the is_owner field in the database.
  29. FieldIsOwner = "is_owner"
  30. // EdgeWxAgent holds the string denoting the wx_agent edge name in mutations.
  31. EdgeWxAgent = "wx_agent"
  32. // Table holds the table name of the agentbase in the database.
  33. Table = "agent_base"
  34. // WxAgentTable is the table that holds the wx_agent relation/edge.
  35. WxAgentTable = "wx"
  36. // WxAgentInverseTable is the table name for the Wx entity.
  37. // It exists in this package in order to avoid circular dependency with the "wx" package.
  38. WxAgentInverseTable = "wx"
  39. // WxAgentColumn is the table column denoting the wx_agent relation/edge.
  40. WxAgentColumn = "agent_base_wx_agent"
  41. )
  42. // Columns holds all SQL columns for agentbase fields.
  43. var Columns = []string{
  44. FieldID,
  45. FieldQ,
  46. FieldA,
  47. FieldChunkIndex,
  48. FieldIndexes,
  49. FieldDatasetID,
  50. FieldCollectionID,
  51. FieldSourceName,
  52. FieldCanWrite,
  53. FieldIsOwner,
  54. }
  55. // ValidColumn reports if the column name is valid (part of the table columns).
  56. func ValidColumn(column string) bool {
  57. for i := range Columns {
  58. if column == Columns[i] {
  59. return true
  60. }
  61. }
  62. return false
  63. }
  64. var (
  65. // DefaultQ holds the default value on creation for the "q" field.
  66. DefaultQ string
  67. // DefaultA holds the default value on creation for the "a" field.
  68. DefaultA string
  69. // ChunkIndexValidator is a validator for the "chunk_index" field. It is called by the builders before save.
  70. ChunkIndexValidator func(uint64) error
  71. // DefaultDatasetID holds the default value on creation for the "dataset_id" field.
  72. DefaultDatasetID string
  73. // DefaultCollectionID holds the default value on creation for the "collection_id" field.
  74. DefaultCollectionID string
  75. // DefaultSourceName holds the default value on creation for the "source_name" field.
  76. DefaultSourceName string
  77. )
  78. // OrderOption defines the ordering options for the AgentBase queries.
  79. type OrderOption func(*sql.Selector)
  80. // ByID orders the results by the id field.
  81. func ByID(opts ...sql.OrderTermOption) OrderOption {
  82. return sql.OrderByField(FieldID, opts...).ToFunc()
  83. }
  84. // ByQ orders the results by the q field.
  85. func ByQ(opts ...sql.OrderTermOption) OrderOption {
  86. return sql.OrderByField(FieldQ, opts...).ToFunc()
  87. }
  88. // ByA orders the results by the a field.
  89. func ByA(opts ...sql.OrderTermOption) OrderOption {
  90. return sql.OrderByField(FieldA, opts...).ToFunc()
  91. }
  92. // ByChunkIndex orders the results by the chunk_index field.
  93. func ByChunkIndex(opts ...sql.OrderTermOption) OrderOption {
  94. return sql.OrderByField(FieldChunkIndex, opts...).ToFunc()
  95. }
  96. // ByDatasetID orders the results by the dataset_id field.
  97. func ByDatasetID(opts ...sql.OrderTermOption) OrderOption {
  98. return sql.OrderByField(FieldDatasetID, opts...).ToFunc()
  99. }
  100. // ByCollectionID orders the results by the collection_id field.
  101. func ByCollectionID(opts ...sql.OrderTermOption) OrderOption {
  102. return sql.OrderByField(FieldCollectionID, opts...).ToFunc()
  103. }
  104. // BySourceName orders the results by the source_name field.
  105. func BySourceName(opts ...sql.OrderTermOption) OrderOption {
  106. return sql.OrderByField(FieldSourceName, opts...).ToFunc()
  107. }
  108. // ByWxAgentCount orders the results by wx_agent count.
  109. func ByWxAgentCount(opts ...sql.OrderTermOption) OrderOption {
  110. return func(s *sql.Selector) {
  111. sqlgraph.OrderByNeighborsCount(s, newWxAgentStep(), opts...)
  112. }
  113. }
  114. // ByWxAgent orders the results by wx_agent terms.
  115. func ByWxAgent(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  116. return func(s *sql.Selector) {
  117. sqlgraph.OrderByNeighborTerms(s, newWxAgentStep(), append([]sql.OrderTerm{term}, terms...)...)
  118. }
  119. }
  120. func newWxAgentStep() *sqlgraph.Step {
  121. return sqlgraph.NewStep(
  122. sqlgraph.From(Table, FieldID),
  123. sqlgraph.To(WxAgentInverseTable, FieldID),
  124. sqlgraph.Edge(sqlgraph.O2M, false, WxAgentTable, WxAgentColumn),
  125. )
  126. }