123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257 |
- // Code generated by ent, DO NOT EDIT.
- package agent
- import (
- "time"
- "entgo.io/ent"
- "entgo.io/ent/dialect/sql"
- "entgo.io/ent/dialect/sql/sqlgraph"
- )
- const (
- // Label holds the string label denoting the agent type in the database.
- Label = "agent"
- // 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"
- // FieldName holds the string denoting the name field in the database.
- FieldName = "name"
- // FieldRole holds the string denoting the role field in the database.
- FieldRole = "role"
- // FieldStatus holds the string denoting the status field in the database.
- FieldStatus = "status"
- // FieldBackground holds the string denoting the background field in the database.
- FieldBackground = "background"
- // FieldExamples holds the string denoting the examples field in the database.
- FieldExamples = "examples"
- // FieldOrganizationID holds the string denoting the organization_id field in the database.
- FieldOrganizationID = "organization_id"
- // FieldDatasetID holds the string denoting the dataset_id field in the database.
- FieldDatasetID = "dataset_id"
- // FieldCollectionID holds the string denoting the collection_id field in the database.
- FieldCollectionID = "collection_id"
- // EdgeWxAgent holds the string denoting the wx_agent edge name in mutations.
- EdgeWxAgent = "wx_agent"
- // EdgeTokenAgent holds the string denoting the token_agent edge name in mutations.
- EdgeTokenAgent = "token_agent"
- // EdgeWaAgent holds the string denoting the wa_agent edge name in mutations.
- EdgeWaAgent = "wa_agent"
- // Table holds the table name of the agent in the database.
- Table = "agent"
- // WxAgentTable is the table that holds the wx_agent relation/edge.
- WxAgentTable = "wx"
- // WxAgentInverseTable is the table name for the Wx entity.
- // It exists in this package in order to avoid circular dependency with the "wx" package.
- WxAgentInverseTable = "wx"
- // WxAgentColumn is the table column denoting the wx_agent relation/edge.
- WxAgentColumn = "agent_id"
- // TokenAgentTable is the table that holds the token_agent relation/edge.
- TokenAgentTable = "token"
- // TokenAgentInverseTable is the table name for the Token entity.
- // It exists in this package in order to avoid circular dependency with the "token" package.
- TokenAgentInverseTable = "token"
- // TokenAgentColumn is the table column denoting the token_agent relation/edge.
- TokenAgentColumn = "agent_id"
- // WaAgentTable is the table that holds the wa_agent relation/edge.
- WaAgentTable = "whatsapp"
- // WaAgentInverseTable is the table name for the Whatsapp entity.
- // It exists in this package in order to avoid circular dependency with the "whatsapp" package.
- WaAgentInverseTable = "whatsapp"
- // WaAgentColumn is the table column denoting the wa_agent relation/edge.
- WaAgentColumn = "agent_id"
- )
- // Columns holds all SQL columns for agent fields.
- var Columns = []string{
- FieldID,
- FieldCreatedAt,
- FieldUpdatedAt,
- FieldDeletedAt,
- FieldName,
- FieldRole,
- FieldStatus,
- FieldBackground,
- FieldExamples,
- FieldOrganizationID,
- FieldDatasetID,
- FieldCollectionID,
- }
- // 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 _ "wechat-api/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
- // NameValidator is a validator for the "name" field. It is called by the builders before save.
- NameValidator func(string) error
- // DefaultStatus holds the default value on creation for the "status" field.
- DefaultStatus int
- // StatusValidator is a validator for the "status" field. It is called by the builders before save.
- StatusValidator func(int) error
- // DefaultBackground holds the default value on creation for the "background" field.
- DefaultBackground string
- // DefaultExamples holds the default value on creation for the "examples" field.
- DefaultExamples string
- // OrganizationIDValidator is a validator for the "organization_id" field. It is called by the builders before save.
- OrganizationIDValidator func(uint64) error
- // DefaultDatasetID holds the default value on creation for the "dataset_id" field.
- DefaultDatasetID string
- // DatasetIDValidator is a validator for the "dataset_id" field. It is called by the builders before save.
- DatasetIDValidator func(string) error
- // DefaultCollectionID holds the default value on creation for the "collection_id" field.
- DefaultCollectionID string
- // CollectionIDValidator is a validator for the "collection_id" field. It is called by the builders before save.
- CollectionIDValidator func(string) error
- )
- // OrderOption defines the ordering options for the Agent 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()
- }
- // ByName orders the results by the name field.
- func ByName(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldName, opts...).ToFunc()
- }
- // ByRole orders the results by the role field.
- func ByRole(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldRole, opts...).ToFunc()
- }
- // ByStatus orders the results by the status field.
- func ByStatus(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldStatus, opts...).ToFunc()
- }
- // ByBackground orders the results by the background field.
- func ByBackground(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldBackground, opts...).ToFunc()
- }
- // ByExamples orders the results by the examples field.
- func ByExamples(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldExamples, opts...).ToFunc()
- }
- // ByOrganizationID orders the results by the organization_id field.
- func ByOrganizationID(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldOrganizationID, opts...).ToFunc()
- }
- // ByDatasetID orders the results by the dataset_id field.
- func ByDatasetID(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldDatasetID, opts...).ToFunc()
- }
- // ByCollectionID orders the results by the collection_id field.
- func ByCollectionID(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldCollectionID, opts...).ToFunc()
- }
- // ByWxAgentCount orders the results by wx_agent count.
- func ByWxAgentCount(opts ...sql.OrderTermOption) OrderOption {
- return func(s *sql.Selector) {
- sqlgraph.OrderByNeighborsCount(s, newWxAgentStep(), opts...)
- }
- }
- // ByWxAgent orders the results by wx_agent terms.
- func ByWxAgent(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
- return func(s *sql.Selector) {
- sqlgraph.OrderByNeighborTerms(s, newWxAgentStep(), append([]sql.OrderTerm{term}, terms...)...)
- }
- }
- // ByTokenAgentCount orders the results by token_agent count.
- func ByTokenAgentCount(opts ...sql.OrderTermOption) OrderOption {
- return func(s *sql.Selector) {
- sqlgraph.OrderByNeighborsCount(s, newTokenAgentStep(), opts...)
- }
- }
- // ByTokenAgent orders the results by token_agent terms.
- func ByTokenAgent(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
- return func(s *sql.Selector) {
- sqlgraph.OrderByNeighborTerms(s, newTokenAgentStep(), append([]sql.OrderTerm{term}, terms...)...)
- }
- }
- // ByWaAgentCount orders the results by wa_agent count.
- func ByWaAgentCount(opts ...sql.OrderTermOption) OrderOption {
- return func(s *sql.Selector) {
- sqlgraph.OrderByNeighborsCount(s, newWaAgentStep(), opts...)
- }
- }
- // ByWaAgent orders the results by wa_agent terms.
- func ByWaAgent(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
- return func(s *sql.Selector) {
- sqlgraph.OrderByNeighborTerms(s, newWaAgentStep(), append([]sql.OrderTerm{term}, terms...)...)
- }
- }
- func newWxAgentStep() *sqlgraph.Step {
- return sqlgraph.NewStep(
- sqlgraph.From(Table, FieldID),
- sqlgraph.To(WxAgentInverseTable, FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, WxAgentTable, WxAgentColumn),
- )
- }
- func newTokenAgentStep() *sqlgraph.Step {
- return sqlgraph.NewStep(
- sqlgraph.From(Table, FieldID),
- sqlgraph.To(TokenAgentInverseTable, FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, TokenAgentTable, TokenAgentColumn),
- )
- }
- func newWaAgentStep() *sqlgraph.Step {
- return sqlgraph.NewStep(
- sqlgraph.From(Table, FieldID),
- sqlgraph.To(WaAgentInverseTable, FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, WaAgentTable, WaAgentColumn),
- )
- }
|