Documentation
¶
Index ¶
- Constants
- Variables
- func And(predicates ...predicate.Post) predicate.Post
- func HasOwner() predicate.Post
- func HasOwnerWith(preds ...predicate.User) predicate.Post
- func HasPinners() predicate.Post
- func HasPinnersWith(preds ...predicate.User) predicate.Post
- func ID(id int) predicate.Post
- func IDEQ(id int) predicate.Post
- func IDGT(id int) predicate.Post
- func IDGTE(id int) predicate.Post
- func IDIn(ids ...int) predicate.Post
- func IDLT(id int) predicate.Post
- func IDLTE(id int) predicate.Post
- func IDNEQ(id int) predicate.Post
- func IDNotIn(ids ...int) predicate.Post
- func Not(p predicate.Post) predicate.Post
- func Or(predicates ...predicate.Post) predicate.Post
- func Published(v bool) predicate.Post
- func PublishedEQ(v bool) predicate.Post
- func PublishedNEQ(v bool) predicate.Post
- func Title(v string) predicate.Post
- func TitleContains(v string) predicate.Post
- func TitleContainsFold(v string) predicate.Post
- func TitleEQ(v string) predicate.Post
- func TitleEqualFold(v string) predicate.Post
- func TitleGT(v string) predicate.Post
- func TitleGTE(v string) predicate.Post
- func TitleHasPrefix(v string) predicate.Post
- func TitleHasSuffix(v string) predicate.Post
- func TitleIn(vs ...string) predicate.Post
- func TitleLT(v string) predicate.Post
- func TitleLTE(v string) predicate.Post
- func TitleNEQ(v string) predicate.Post
- func TitleNotIn(vs ...string) predicate.Post
- func ValidColumn(column string) bool
- type Mutation
- func (m *Mutation) AddField(name string, value ent.Value) error
- func (m *Mutation) AddPinnerIDs(ids ...int)
- func (m *Mutation) AddedEdges() []string
- func (m *Mutation) AddedField(name string) (ent.Value, bool)
- func (m *Mutation) AddedFields() []string
- func (m *Mutation) AddedIDs(name string) []ent.Value
- func (m *Mutation) ClearEdge(name string) error
- func (m *Mutation) ClearField(name string) error
- func (m *Mutation) ClearOwner()
- func (m *Mutation) ClearPinners()
- func (m *Mutation) ClearedEdges() []string
- func (m *Mutation) ClearedFields() []string
- func (m *Mutation) EdgeCleared(name string) bool
- func (m *Mutation) Field(name string) (ent.Value, bool)
- func (m *Mutation) FieldCleared(name string) bool
- func (m *Mutation) Fields() []string
- func (m *Mutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *Mutation) Op() ent.Op
- func (m *Mutation) OwnerCleared() bool
- func (m *Mutation) OwnerID() (id int, exists bool)
- func (m *Mutation) OwnerIDs() (ids []int)
- func (m *Mutation) PinnersCleared() bool
- func (m *Mutation) PinnersIDs() (ids []int)
- func (m *Mutation) Predicates() []predicate.Post
- func (m *Mutation) Published() (r bool, exists bool)
- func (m *Mutation) RemovePinnerIDs(ids ...int)
- func (m *Mutation) RemovedEdges() []string
- func (m *Mutation) RemovedIDs(name string) []ent.Value
- func (m *Mutation) RemovedPinnersIDs() (ids []int)
- func (m *Mutation) ResetEdge(name string) error
- func (m *Mutation) ResetField(name string) error
- func (m *Mutation) ResetOwner()
- func (m *Mutation) ResetPinners()
- func (m *Mutation) ResetPublished()
- func (m *Mutation) ResetTitle()
- func (m *Mutation) SetField(name string, value ent.Value) error
- func (m *Mutation) SetOp(op ent.Op)
- func (m *Mutation) SetOwnerID(id int)
- func (m *Mutation) SetPublished(b bool)
- func (m *Mutation) SetTitle(s string)
- func (m *Mutation) Title() (r string, exists bool)
- func (m *Mutation) Type() string
- func (m *Mutation) Where(ps ...predicate.Post)
- func (m *Mutation) WhereP(ps ...func(*sql.Selector))
- type OrderOption
- func ByID(opts ...sql.OrderTermOption) OrderOption
- func ByOwnerField(field string, opts ...sql.OrderTermOption) OrderOption
- func ByPinners(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption
- func ByPinnersCount(opts ...sql.OrderTermOption) OrderOption
- func ByPublished(opts ...sql.OrderTermOption) OrderOption
- func ByTitle(opts ...sql.OrderTermOption) OrderOption
Constants ¶
const ( // Label holds the string label denoting the post type in the database. Label = "post" // FieldID holds the string denoting the id field in the database. FieldID = "id" // FieldTitle holds the string denoting the title field in the database. FieldTitle = "title" // FieldPublished holds the string denoting the published field in the database. FieldPublished = "published" // EdgeOwner holds the string denoting the owner edge name in mutations. EdgeOwner = "owner" // EdgePinners holds the string denoting the pinners edge name in mutations. EdgePinners = "pinners" // Table holds the table name of the post in the database. Table = "posts" // OwnerTable is the table that holds the owner relation/edge. OwnerTable = "posts" // OwnerInverseTable is the table name for the User entity. // It exists in this package in order to avoid circular dependency with the "user" package. OwnerInverseTable = "users" // OwnerColumn is the table column denoting the owner relation/edge. OwnerColumn = "user_posts" // PinnersTable is the table that holds the pinners relation/edge. PinnersTable = "users" // PinnersInverseTable is the table name for the User entity. // It exists in this package in order to avoid circular dependency with the "user" package. PinnersInverseTable = "users" // PinnersColumn is the table column denoting the pinners relation/edge. PinnersColumn = "user_pinned_post" )
Variables ¶
var Columns = []string{ FieldID, FieldTitle, FieldPublished, }
Columns holds all SQL columns for post fields.
var ( // DefaultPublished holds the default value on creation for the "published" field. DefaultPublished bool )
var ForeignKeys = []string{
"user_posts",
}
ForeignKeys holds the SQL foreign-keys that are owned by the "posts" table and are not defined as standalone fields in the schema.
Functions ¶
func HasOwnerWith ¶
HasOwnerWith applies the HasEdge predicate on the "owner" edge with a given conditions (other predicates).
func HasPinners ¶
HasPinners applies the HasEdge predicate on the "pinners" edge.
func HasPinnersWith ¶
HasPinnersWith applies the HasEdge predicate on the "pinners" edge with a given conditions (other predicates).
func Published ¶
Published applies equality check predicate on the "published" field. It's identical to PublishedEQ.
func PublishedEQ ¶
PublishedEQ applies the EQ predicate on the "published" field.
func PublishedNEQ ¶
PublishedNEQ applies the NEQ predicate on the "published" field.
func Title ¶
Title applies equality check predicate on the "title" field. It's identical to TitleEQ.
func TitleContains ¶
TitleContains applies the Contains predicate on the "title" field.
func TitleContainsFold ¶
TitleContainsFold applies the ContainsFold predicate on the "title" field.
func TitleEqualFold ¶
TitleEqualFold applies the EqualFold predicate on the "title" field.
func TitleHasPrefix ¶
TitleHasPrefix applies the HasPrefix predicate on the "title" field.
func TitleHasSuffix ¶
TitleHasSuffix applies the HasSuffix predicate on the "title" field.
func TitleNotIn ¶
TitleNotIn applies the NotIn predicate on the "title" field.
func ValidColumn ¶
ValidColumn reports if the column name is valid (part of the table columns).
Types ¶
type Mutation ¶ added in v1.6.0
type Mutation struct {
// contains filtered or unexported fields
}
Mutation represents an operation that mutates the Post nodes in the graph.
func NewMutation ¶ added in v1.6.0
NewMutation creates a new Mutation for the Post entity.
func (*Mutation) AddField ¶ added in v1.6.0
AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.
func (*Mutation) AddPinnerIDs ¶ added in v1.6.0
AddPinnerIDs adds the "pinners" edge to the User entity by ids.
func (*Mutation) AddedEdges ¶ added in v1.6.0
AddedEdges returns all edge names that were set/added in this mutation.
func (*Mutation) AddedField ¶ added in v1.6.0
AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.
func (*Mutation) AddedFields ¶ added in v1.6.0
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*Mutation) AddedIDs ¶ added in v1.6.0
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*Mutation) ClearEdge ¶ added in v1.6.0
ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.
func (*Mutation) ClearField ¶ added in v1.6.0
ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.
func (*Mutation) ClearOwner ¶ added in v1.6.0
func (m *Mutation) ClearOwner()
ClearOwner clears the "owner" edge to the User entity.
func (*Mutation) ClearPinners ¶ added in v1.6.0
func (m *Mutation) ClearPinners()
ClearPinners clears the "pinners" edge to the User entity.
func (*Mutation) ClearedEdges ¶ added in v1.6.0
ClearedEdges returns all edge names that were cleared in this mutation.
func (*Mutation) ClearedFields ¶ added in v1.6.0
ClearedFields returns all nullable fields that were cleared during this mutation.
func (*Mutation) EdgeCleared ¶ added in v1.6.0
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*Mutation) Field ¶ added in v1.6.0
Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.
func (*Mutation) FieldCleared ¶ added in v1.6.0
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*Mutation) Fields ¶ added in v1.6.0
Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().
func (*Mutation) OldField ¶ added in v1.6.0
OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.
func (*Mutation) OwnerCleared ¶ added in v1.6.0
OwnerCleared reports if the "owner" edge to the User entity was cleared.
func (*Mutation) OwnerIDs ¶ added in v1.6.0
OwnerIDs returns the "owner" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use OwnerID instead. It exists only for internal usage by the builders.
func (*Mutation) PinnersCleared ¶ added in v1.6.0
PinnersCleared reports if the "pinners" edge to the User entity was cleared.
func (*Mutation) PinnersIDs ¶ added in v1.6.0
PinnersIDs returns the "pinners" edge IDs in the mutation.
func (*Mutation) Predicates ¶ added in v1.6.0
Predicates returns the list of predicates set on the mutation.
func (*Mutation) Published ¶ added in v1.6.0
Published returns the value of the "published" field in the mutation.
func (*Mutation) RemovePinnerIDs ¶ added in v1.6.0
RemovePinnerIDs removes the "pinners" edge to the User entity by IDs.
func (*Mutation) RemovedEdges ¶ added in v1.6.0
RemovedEdges returns all edge names that were removed in this mutation.
func (*Mutation) RemovedIDs ¶ added in v1.6.0
RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.
func (*Mutation) RemovedPinnersIDs ¶ added in v1.6.0
RemovedPinners returns the removed IDs of the "pinners" edge to the User entity.
func (*Mutation) ResetEdge ¶ added in v1.6.0
ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.
func (*Mutation) ResetField ¶ added in v1.6.0
ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.
func (*Mutation) ResetOwner ¶ added in v1.6.0
func (m *Mutation) ResetOwner()
ResetOwner resets all changes to the "owner" edge.
func (*Mutation) ResetPinners ¶ added in v1.6.0
func (m *Mutation) ResetPinners()
ResetPinners resets all changes to the "pinners" edge.
func (*Mutation) ResetPublished ¶ added in v1.6.0
func (m *Mutation) ResetPublished()
ResetPublished resets all changes to the "published" field.
func (*Mutation) ResetTitle ¶ added in v1.6.0
func (m *Mutation) ResetTitle()
ResetTitle resets all changes to the "title" field.
func (*Mutation) SetField ¶ added in v1.6.0
SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.
func (*Mutation) SetOwnerID ¶ added in v1.6.0
SetOwnerID sets the "owner" edge to the User entity by id.
func (*Mutation) SetPublished ¶ added in v1.6.0
SetPublished sets the "published" field.
func (*Mutation) Title ¶ added in v1.6.0
Title returns the value of the "title" field in the mutation.
type OrderOption ¶
OrderOption defines the ordering options for the Post queries.
func ByID ¶
func ByID(opts ...sql.OrderTermOption) OrderOption
ByID orders the results by the id field.
func ByOwnerField ¶
func ByOwnerField(field string, opts ...sql.OrderTermOption) OrderOption
ByOwnerField orders the results by owner field.
func ByPinners ¶
func ByPinners(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption
ByPinners orders the results by pinners terms.
func ByPinnersCount ¶
func ByPinnersCount(opts ...sql.OrderTermOption) OrderOption
ByPinnersCount orders the results by pinners count.
func ByPublished ¶
func ByPublished(opts ...sql.OrderTermOption) OrderOption
ByPublished orders the results by the published field.
func ByTitle ¶
func ByTitle(opts ...sql.OrderTermOption) OrderOption
ByTitle orders the results by the title field.