Skip to content

A continuation of HomeBox the inventory and organization system built for the Home User

14.1 KB
Raw Blame
// Code generated by ent, DO NOT EDIT.

package group

import (
	"time"

	"entgo.io/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"github.com/google/uuid"
)

const (
	// Label holds the string label denoting the group type in the database.
	Label = "group"
	// 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"
	// FieldName holds the string denoting the name field in the database.
	FieldName = "name"
	// FieldCurrency holds the string denoting the currency field in the database.
	FieldCurrency = "currency"
	// EdgeUsers holds the string denoting the users edge name in mutations.
	EdgeUsers = "users"
	// EdgeEntityTypes holds the string denoting the entity_types edge name in mutations.
	EdgeEntityTypes = "entity_types"
	// EdgeEntities holds the string denoting the entities edge name in mutations.
	EdgeEntities = "entities"
	// EdgeTags holds the string denoting the tags edge name in mutations.
	EdgeTags = "tags"
	// EdgeInvitationTokens holds the string denoting the invitation_tokens edge name in mutations.
	EdgeInvitationTokens = "invitation_tokens"
	// EdgeNotifiers holds the string denoting the notifiers edge name in mutations.
	EdgeNotifiers = "notifiers"
	// EdgeEntityTemplates holds the string denoting the entity_templates edge name in mutations.
	EdgeEntityTemplates = "entity_templates"
	// EdgeExports holds the string denoting the exports edge name in mutations.
	EdgeExports = "exports"
	// EdgeUserGroups holds the string denoting the user_groups edge name in mutations.
	EdgeUserGroups = "user_groups"
	// Table holds the table name of the group in the database.
	Table = "groups"
	// UsersTable is the table that holds the users relation/edge. The primary key declared below.
	UsersTable = "user_groups"
	// UsersInverseTable is the table name for the User entity.
	// It exists in this package in order to avoid circular dependency with the "user" package.
	UsersInverseTable = "users"
	// EntityTypesTable is the table that holds the entity_types relation/edge.
	EntityTypesTable = "entity_types"
	// EntityTypesInverseTable is the table name for the EntityType entity.
	// It exists in this package in order to avoid circular dependency with the "entitytype" package.
	EntityTypesInverseTable = "entity_types"
	// EntityTypesColumn is the table column denoting the entity_types relation/edge.
	EntityTypesColumn = "group_entity_types"
	// EntitiesTable is the table that holds the entities relation/edge.
	EntitiesTable = "entities"
	// EntitiesInverseTable is the table name for the Entity entity.
	// It exists in this package in order to avoid circular dependency with the "entity" package.
	EntitiesInverseTable = "entities"
	// EntitiesColumn is the table column denoting the entities relation/edge.
	EntitiesColumn = "group_entities"
	// TagsTable is the table that holds the tags relation/edge.
	TagsTable = "tags"
	// TagsInverseTable is the table name for the Tag entity.
	// It exists in this package in order to avoid circular dependency with the "tag" package.
	TagsInverseTable = "tags"
	// TagsColumn is the table column denoting the tags relation/edge.
	TagsColumn = "group_tags"
	// InvitationTokensTable is the table that holds the invitation_tokens relation/edge.
	InvitationTokensTable = "group_invitation_tokens"
	// InvitationTokensInverseTable is the table name for the GroupInvitationToken entity.
	// It exists in this package in order to avoid circular dependency with the "groupinvitationtoken" package.
	InvitationTokensInverseTable = "group_invitation_tokens"
	// InvitationTokensColumn is the table column denoting the invitation_tokens relation/edge.
	InvitationTokensColumn = "group_invitation_tokens"
	// NotifiersTable is the table that holds the notifiers relation/edge.
	NotifiersTable = "notifiers"
	// NotifiersInverseTable is the table name for the Notifier entity.
	// It exists in this package in order to avoid circular dependency with the "notifier" package.
	NotifiersInverseTable = "notifiers"
	// NotifiersColumn is the table column denoting the notifiers relation/edge.
	NotifiersColumn = "group_id"
	// EntityTemplatesTable is the table that holds the entity_templates relation/edge.
	EntityTemplatesTable = "entity_templates"
	// EntityTemplatesInverseTable is the table name for the EntityTemplate entity.
	// It exists in this package in order to avoid circular dependency with the "entitytemplate" package.
	EntityTemplatesInverseTable = "entity_templates"
	// EntityTemplatesColumn is the table column denoting the entity_templates relation/edge.
	EntityTemplatesColumn = "group_entity_templates"
	// ExportsTable is the table that holds the exports relation/edge.
	ExportsTable = "exports"
	// ExportsInverseTable is the table name for the Export entity.
	// It exists in this package in order to avoid circular dependency with the "export" package.
	ExportsInverseTable = "exports"
	// ExportsColumn is the table column denoting the exports relation/edge.
	ExportsColumn = "group_id"
	// UserGroupsTable is the table that holds the user_groups relation/edge.
	UserGroupsTable = "user_groups"
	// UserGroupsInverseTable is the table name for the UserGroup entity.
	// It exists in this package in order to avoid circular dependency with the "usergroup" package.
	UserGroupsInverseTable = "user_groups"
	// UserGroupsColumn is the table column denoting the user_groups relation/edge.
	UserGroupsColumn = "group_id"
)

// Columns holds all SQL columns for group fields.
var Columns = []string{
	FieldID,
	FieldCreatedAt,
	FieldUpdatedAt,
	FieldName,
	FieldCurrency,
}

var (
	// UsersPrimaryKey and UsersColumn2 are the table columns denoting the
	// primary key for the users relation (M2M).
	UsersPrimaryKey = []string{"user_id", "group_id"}
)

// 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 (
	// 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
	// DefaultCurrency holds the default value on creation for the "currency" field.
	DefaultCurrency string
	// DefaultID holds the default value on creation for the "id" field.
	DefaultID func() uuid.UUID
)

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

// ByName orders the results by the name field.
func ByName(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldName, opts...).ToFunc()
}

// ByCurrency orders the results by the currency field.
func ByCurrency(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCurrency, opts...).ToFunc()
}

// ByUsersCount orders the results by users count.
func ByUsersCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newUsersStep(), opts...)
	}
}

// ByUsers orders the results by users terms.
func ByUsers(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newUsersStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}

// ByEntityTypesCount orders the results by entity_types count.
func ByEntityTypesCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newEntityTypesStep(), opts...)
	}
}

// ByEntityTypes orders the results by entity_types terms.
func ByEntityTypes(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newEntityTypesStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}

// ByEntitiesCount orders the results by entities count.
func ByEntitiesCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newEntitiesStep(), opts...)
	}
}

// ByEntities orders the results by entities terms.
func ByEntities(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newEntitiesStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}

// ByTagsCount orders the results by tags count.
func ByTagsCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newTagsStep(), opts...)
	}
}

// ByTags orders the results by tags terms.
func ByTags(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newTagsStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}

// ByInvitationTokensCount orders the results by invitation_tokens count.
func ByInvitationTokensCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newInvitationTokensStep(), opts...)
	}
}

// ByInvitationTokens orders the results by invitation_tokens terms.
func ByInvitationTokens(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newInvitationTokensStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}

// ByNotifiersCount orders the results by notifiers count.
func ByNotifiersCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newNotifiersStep(), opts...)
	}
}

// ByNotifiers orders the results by notifiers terms.
func ByNotifiers(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newNotifiersStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}

// ByEntityTemplatesCount orders the results by entity_templates count.
func ByEntityTemplatesCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newEntityTemplatesStep(), opts...)
	}
}

// ByEntityTemplates orders the results by entity_templates terms.
func ByEntityTemplates(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newEntityTemplatesStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}

// ByExportsCount orders the results by exports count.
func ByExportsCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newExportsStep(), opts...)
	}
}

// ByExports orders the results by exports terms.
func ByExports(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newExportsStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}

// ByUserGroupsCount orders the results by user_groups count.
func ByUserGroupsCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newUserGroupsStep(), opts...)
	}
}

// ByUserGroups orders the results by user_groups terms.
func ByUserGroups(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newUserGroupsStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}
func newUsersStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(UsersInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2M, true, UsersTable, UsersPrimaryKey...),
	)
}
func newEntityTypesStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(EntityTypesInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, EntityTypesTable, EntityTypesColumn),
	)
}
func newEntitiesStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(EntitiesInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, EntitiesTable, EntitiesColumn),
	)
}
func newTagsStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(TagsInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, TagsTable, TagsColumn),
	)
}
func newInvitationTokensStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(InvitationTokensInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, InvitationTokensTable, InvitationTokensColumn),
	)
}
func newNotifiersStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(NotifiersInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, NotifiersTable, NotifiersColumn),
	)
}
func newEntityTemplatesStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(EntityTemplatesInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, EntityTemplatesTable, EntityTemplatesColumn),
	)
}
func newExportsStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(ExportsInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, ExportsTable, ExportsColumn),
	)
}
func newUserGroupsStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(UserGroupsInverseTable, UserGroupsColumn),
		sqlgraph.Edge(sqlgraph.O2M, true, UserGroupsTable, UserGroupsColumn),
	)
}