post

package
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
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

Columns holds all SQL columns for post fields.

View Source
var (
	// DefaultPublished holds the default value on creation for the "published" field.
	DefaultPublished bool
)
View Source
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 And

func And(predicates ...predicate.Post) predicate.Post

And groups predicates with the AND operator between them.

func HasOwner

func HasOwner() predicate.Post

HasOwner applies the HasEdge predicate on the "owner" edge.

func HasOwnerWith

func HasOwnerWith(preds ...predicate.User) predicate.Post

HasOwnerWith applies the HasEdge predicate on the "owner" edge with a given conditions (other predicates).

func HasPinners

func HasPinners() predicate.Post

HasPinners applies the HasEdge predicate on the "pinners" edge.

func HasPinnersWith

func HasPinnersWith(preds ...predicate.User) predicate.Post

HasPinnersWith applies the HasEdge predicate on the "pinners" edge with a given conditions (other predicates).

func ID

func ID(id int) predicate.Post

ID filters vertices based on their ID field.

func IDEQ

func IDEQ(id int) predicate.Post

IDEQ applies the EQ predicate on the ID field.

func IDGT

func IDGT(id int) predicate.Post

IDGT applies the GT predicate on the ID field.

func IDGTE

func IDGTE(id int) predicate.Post

IDGTE applies the GTE predicate on the ID field.

func IDIn

func IDIn(ids ...int) predicate.Post

IDIn applies the In predicate on the ID field.

func IDLT

func IDLT(id int) predicate.Post

IDLT applies the LT predicate on the ID field.

func IDLTE

func IDLTE(id int) predicate.Post

IDLTE applies the LTE predicate on the ID field.

func IDNEQ

func IDNEQ(id int) predicate.Post

IDNEQ applies the NEQ predicate on the ID field.

func IDNotIn

func IDNotIn(ids ...int) predicate.Post

IDNotIn applies the NotIn predicate on the ID field.

func Not

Not applies the not operator on the given predicate.

func Or

func Or(predicates ...predicate.Post) predicate.Post

Or groups predicates with the OR operator between them.

func Published

func Published(v bool) predicate.Post

Published applies equality check predicate on the "published" field. It's identical to PublishedEQ.

func PublishedEQ

func PublishedEQ(v bool) predicate.Post

PublishedEQ applies the EQ predicate on the "published" field.

func PublishedNEQ

func PublishedNEQ(v bool) predicate.Post

PublishedNEQ applies the NEQ predicate on the "published" field.

func Title

func Title(v string) predicate.Post

Title applies equality check predicate on the "title" field. It's identical to TitleEQ.

func TitleContains

func TitleContains(v string) predicate.Post

TitleContains applies the Contains predicate on the "title" field.

func TitleContainsFold

func TitleContainsFold(v string) predicate.Post

TitleContainsFold applies the ContainsFold predicate on the "title" field.

func TitleEQ

func TitleEQ(v string) predicate.Post

TitleEQ applies the EQ predicate on the "title" field.

func TitleEqualFold

func TitleEqualFold(v string) predicate.Post

TitleEqualFold applies the EqualFold predicate on the "title" field.

func TitleGT

func TitleGT(v string) predicate.Post

TitleGT applies the GT predicate on the "title" field.

func TitleGTE

func TitleGTE(v string) predicate.Post

TitleGTE applies the GTE predicate on the "title" field.

func TitleHasPrefix

func TitleHasPrefix(v string) predicate.Post

TitleHasPrefix applies the HasPrefix predicate on the "title" field.

func TitleHasSuffix

func TitleHasSuffix(v string) predicate.Post

TitleHasSuffix applies the HasSuffix predicate on the "title" field.

func TitleIn

func TitleIn(vs ...string) predicate.Post

TitleIn applies the In predicate on the "title" field.

func TitleLT

func TitleLT(v string) predicate.Post

TitleLT applies the LT predicate on the "title" field.

func TitleLTE

func TitleLTE(v string) predicate.Post

TitleLTE applies the LTE predicate on the "title" field.

func TitleNEQ

func TitleNEQ(v string) predicate.Post

TitleNEQ applies the NEQ predicate on the "title" field.

func TitleNotIn

func TitleNotIn(vs ...string) predicate.Post

TitleNotIn applies the NotIn predicate on the "title" field.

func ValidColumn

func ValidColumn(column string) bool

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

func NewMutation(op ent.Op) *Mutation

NewMutation creates a new Mutation for the Post entity.

func (*Mutation) AddField added in v1.6.0

func (m *Mutation) AddField(name string, value ent.Value) error

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

func (m *Mutation) AddPinnerIDs(ids ...int)

AddPinnerIDs adds the "pinners" edge to the User entity by ids.

func (*Mutation) AddedEdges added in v1.6.0

func (m *Mutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*Mutation) AddedField added in v1.6.0

func (m *Mutation) AddedField(name string) (ent.Value, bool)

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

func (m *Mutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*Mutation) AddedIDs added in v1.6.0

func (m *Mutation) AddedIDs(name string) []ent.Value

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

func (m *Mutation) ClearEdge(name string) error

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

func (m *Mutation) ClearField(name string) error

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

func (m *Mutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*Mutation) ClearedFields added in v1.6.0

func (m *Mutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (*Mutation) EdgeCleared added in v1.6.0

func (m *Mutation) EdgeCleared(name string) bool

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

func (m *Mutation) Field(name string) (ent.Value, bool)

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

func (m *Mutation) FieldCleared(name string) bool

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

func (m *Mutation) Fields() []string

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

func (m *Mutation) OldField(ctx context.Context, name string) (ent.Value, error)

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) Op added in v1.6.0

func (m *Mutation) Op() ent.Op

Op returns the operation name.

func (*Mutation) OwnerCleared added in v1.6.0

func (m *Mutation) OwnerCleared() bool

OwnerCleared reports if the "owner" edge to the User entity was cleared.

func (*Mutation) OwnerID added in v1.6.0

func (m *Mutation) OwnerID() (id int, exists bool)

OwnerID returns the "owner" edge ID in the mutation.

func (*Mutation) OwnerIDs added in v1.6.0

func (m *Mutation) OwnerIDs() (ids []int)

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

func (m *Mutation) PinnersCleared() bool

PinnersCleared reports if the "pinners" edge to the User entity was cleared.

func (*Mutation) PinnersIDs added in v1.6.0

func (m *Mutation) PinnersIDs() (ids []int)

PinnersIDs returns the "pinners" edge IDs in the mutation.

func (*Mutation) Predicates added in v1.6.0

func (m *Mutation) Predicates() []predicate.Post

Predicates returns the list of predicates set on the mutation.

func (*Mutation) Published added in v1.6.0

func (m *Mutation) Published() (r bool, exists bool)

Published returns the value of the "published" field in the mutation.

func (*Mutation) RemovePinnerIDs added in v1.6.0

func (m *Mutation) RemovePinnerIDs(ids ...int)

RemovePinnerIDs removes the "pinners" edge to the User entity by IDs.

func (*Mutation) RemovedEdges added in v1.6.0

func (m *Mutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*Mutation) RemovedIDs added in v1.6.0

func (m *Mutation) RemovedIDs(name string) []ent.Value

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

func (m *Mutation) RemovedPinnersIDs() (ids []int)

RemovedPinners returns the removed IDs of the "pinners" edge to the User entity.

func (*Mutation) ResetEdge added in v1.6.0

func (m *Mutation) ResetEdge(name string) error

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

func (m *Mutation) ResetField(name string) error

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

func (m *Mutation) SetField(name string, value ent.Value) error

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) SetOp added in v1.6.0

func (m *Mutation) SetOp(op ent.Op)

SetOp allows setting the mutation operation.

func (*Mutation) SetOwnerID added in v1.6.0

func (m *Mutation) SetOwnerID(id int)

SetOwnerID sets the "owner" edge to the User entity by id.

func (*Mutation) SetPublished added in v1.6.0

func (m *Mutation) SetPublished(b bool)

SetPublished sets the "published" field.

func (*Mutation) SetTitle added in v1.6.0

func (m *Mutation) SetTitle(s string)

SetTitle sets the "title" field.

func (*Mutation) Title added in v1.6.0

func (m *Mutation) Title() (r string, exists bool)

Title returns the value of the "title" field in the mutation.

func (*Mutation) Type added in v1.6.0

func (m *Mutation) Type() string

Type returns the node type of this mutation (Post).

func (*Mutation) Where added in v1.6.0

func (m *Mutation) Where(ps ...predicate.Post)

Where appends a list predicates to the Mutation builder.

func (*Mutation) WhereP added in v1.6.0

func (m *Mutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the Mutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type OrderOption

type OrderOption func(*sql.Selector)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL