132 lines
4 KiB
Go
132 lines
4 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package contributorsociallink
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
)
|
|
|
|
const (
|
|
// Label holds the string label denoting the contributorsociallink type in the database.
|
|
Label = "contributor_social_link"
|
|
// FieldID holds the string denoting the id field in the database.
|
|
FieldID = "id"
|
|
// FieldType holds the string denoting the type field in the database.
|
|
FieldType = "type"
|
|
// FieldName holds the string denoting the name field in the database.
|
|
FieldName = "name"
|
|
// FieldValue holds the string denoting the value field in the database.
|
|
FieldValue = "value"
|
|
// EdgeContributor holds the string denoting the contributor edge name in mutations.
|
|
EdgeContributor = "contributor"
|
|
// Table holds the table name of the contributorsociallink in the database.
|
|
Table = "contributor_social_links"
|
|
// ContributorTable is the table that holds the contributor relation/edge.
|
|
ContributorTable = "contributor_social_links"
|
|
// ContributorInverseTable is the table name for the Contributor entity.
|
|
// It exists in this package in order to avoid circular dependency with the "contributor" package.
|
|
ContributorInverseTable = "contributors"
|
|
// ContributorColumn is the table column denoting the contributor relation/edge.
|
|
ContributorColumn = "contributor_social_links"
|
|
)
|
|
|
|
// Columns holds all SQL columns for contributorsociallink fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldType,
|
|
FieldName,
|
|
FieldValue,
|
|
}
|
|
|
|
// ForeignKeys holds the SQL foreign-keys that are owned by the "contributor_social_links"
|
|
// table and are not defined as standalone fields in the schema.
|
|
var ForeignKeys = []string{
|
|
"contributor_social_links",
|
|
}
|
|
|
|
// 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
|
|
}
|
|
}
|
|
for i := range ForeignKeys {
|
|
if column == ForeignKeys[i] {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
var (
|
|
// ValueValidator is a validator for the "value" field. It is called by the builders before save.
|
|
ValueValidator func(string) error
|
|
)
|
|
|
|
// Type defines the type for the "type" enum field.
|
|
type Type string
|
|
|
|
// Type values.
|
|
const (
|
|
TypeTWITTER Type = "twitter"
|
|
TypeFACEBOOK Type = "facebook"
|
|
TypeINSTAGRAM Type = "instagram"
|
|
TypeLINKEDIN Type = "linkedin"
|
|
TypeGITHUB Type = "github"
|
|
TypeWEBSITE Type = "website"
|
|
)
|
|
|
|
func (_type Type) String() string {
|
|
return string(_type)
|
|
}
|
|
|
|
// TypeValidator is a validator for the "type" field enum values. It is called by the builders before save.
|
|
func TypeValidator(_type Type) error {
|
|
switch _type {
|
|
case TypeTWITTER, TypeFACEBOOK, TypeINSTAGRAM, TypeLINKEDIN, TypeGITHUB, TypeWEBSITE:
|
|
return nil
|
|
default:
|
|
return fmt.Errorf("contributorsociallink: invalid enum value for type field: %q", _type)
|
|
}
|
|
}
|
|
|
|
// OrderOption defines the ordering options for the ContributorSocialLink 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()
|
|
}
|
|
|
|
// ByType orders the results by the type field.
|
|
func ByType(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldType, opts...).ToFunc()
|
|
}
|
|
|
|
// ByName orders the results by the name field.
|
|
func ByName(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldName, opts...).ToFunc()
|
|
}
|
|
|
|
// ByValue orders the results by the value field.
|
|
func ByValue(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldValue, opts...).ToFunc()
|
|
}
|
|
|
|
// ByContributorField orders the results by contributor field.
|
|
func ByContributorField(field string, opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newContributorStep(), sql.OrderByField(field, opts...))
|
|
}
|
|
}
|
|
func newContributorStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(ContributorInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, ContributorTable, ContributorColumn),
|
|
)
|
|
}
|