ent

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2021 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Operation types.
	OpCreate    = ent.OpCreate
	OpDelete    = ent.OpDelete
	OpDeleteOne = ent.OpDeleteOne
	OpUpdate    = ent.OpUpdate
	OpUpdateOne = ent.OpUpdateOne

	// Node types.
	TypeArticle      = "Article"
	TypeBoard        = "Board"
	TypeComment      = "Comment"
	TypeKhumuUser    = "KhumuUser"
	TypeLikeComment  = "LikeComment"
	TypeStudyArticle = "StudyArticle"
)

Variables

This section is empty.

Functions

func IsConstraintError

func IsConstraintError(err error) bool

IsConstraintError returns a boolean indicating whether the error is a constraint failure.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns a boolean indicating whether the error is a not found error.

func IsNotLoaded

func IsNotLoaded(err error) bool

IsNotLoaded returns a boolean indicating whether the error is a not loaded error.

func IsNotSingular

func IsNotSingular(err error) bool

IsNotSingular returns a boolean indicating whether the error is a not singular error.

func IsValidationError

func IsValidationError(err error) bool

IsValidationError returns a boolean indicating whether the error is a validaton error.

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

func NewContext(parent context.Context, c *Client) context.Context

NewContext returns a new context with the given Client attached.

func NewTxContext

func NewTxContext(parent context.Context, tx *Tx) context.Context

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

AggregateFunc applies an aggregation step on the group-by traversal/selector.

func As

As is a pseudo aggregation function for renaming another other functions with custom names. For example:

GroupBy(field1, field2).
Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")).
Scan(ctx, &v)

func Count

func Count() AggregateFunc

Count applies the "count" aggregation function on each group.

func Max

func Max(field string) AggregateFunc

Max applies the "max" aggregation function on the given field of each group.

func Mean

func Mean(field string) AggregateFunc

Mean applies the "mean" aggregation function on the given field of each group.

func Min

func Min(field string) AggregateFunc

Min applies the "min" aggregation function on the given field of each group.

func Sum

func Sum(field string) AggregateFunc

Sum applies the "sum" aggregation function on the given field of each group.

type Article

type Article struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Title holds the value of the "title" field.
	Title string `json:"title,omitempty"`
	// Images holds the value of the "images" field.
	Images *[]string `json:"images,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the ArticleQuery when eager-loading is set.
	Edges ArticleEdges `json:"edges"`
	// contains filtered or unexported fields
}

Article is the model entity for the Article schema.

func (*Article) QueryAuthor

func (a *Article) QueryAuthor() *KhumuUserQuery

QueryAuthor queries the "author" edge of the Article entity.

func (*Article) QueryComments

func (a *Article) QueryComments() *CommentQuery

QueryComments queries the "comments" edge of the Article entity.

func (*Article) String

func (a *Article) String() string

String implements the fmt.Stringer.

func (*Article) Unwrap

func (a *Article) Unwrap() *Article

Unwrap unwraps the Article entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*Article) Update

func (a *Article) Update() *ArticleUpdateOne

Update returns a builder for updating this Article. Note that you need to call Article.Unwrap() before calling this method if this Article was returned from a transaction, and the transaction was committed or rolled back.

type ArticleClient

type ArticleClient struct {
	// contains filtered or unexported fields
}

ArticleClient is a client for the Article schema.

func NewArticleClient

func NewArticleClient(c config) *ArticleClient

NewArticleClient returns a client for the Article from the given config.

func (*ArticleClient) Create

func (c *ArticleClient) Create() *ArticleCreate

Create returns a create builder for Article.

func (*ArticleClient) CreateBulk

func (c *ArticleClient) CreateBulk(builders ...*ArticleCreate) *ArticleCreateBulk

CreateBulk returns a builder for creating a bulk of Article entities.

func (*ArticleClient) Delete

func (c *ArticleClient) Delete() *ArticleDelete

Delete returns a delete builder for Article.

func (*ArticleClient) DeleteOne

func (c *ArticleClient) DeleteOne(a *Article) *ArticleDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*ArticleClient) DeleteOneID

func (c *ArticleClient) DeleteOneID(id int) *ArticleDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*ArticleClient) Get

func (c *ArticleClient) Get(ctx context.Context, id int) (*Article, error)

Get returns a Article entity by its id.

func (*ArticleClient) GetX

func (c *ArticleClient) GetX(ctx context.Context, id int) *Article

GetX is like Get, but panics if an error occurs.

func (*ArticleClient) Hooks

func (c *ArticleClient) Hooks() []Hook

Hooks returns the client hooks.

func (*ArticleClient) Query

func (c *ArticleClient) Query() *ArticleQuery

Query returns a query builder for Article.

func (*ArticleClient) QueryAuthor

func (c *ArticleClient) QueryAuthor(a *Article) *KhumuUserQuery

QueryAuthor queries the author edge of a Article.

func (*ArticleClient) QueryComments

func (c *ArticleClient) QueryComments(a *Article) *CommentQuery

QueryComments queries the comments edge of a Article.

func (*ArticleClient) Update

func (c *ArticleClient) Update() *ArticleUpdate

Update returns an update builder for Article.

func (*ArticleClient) UpdateOne

func (c *ArticleClient) UpdateOne(a *Article) *ArticleUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ArticleClient) UpdateOneID

func (c *ArticleClient) UpdateOneID(id int) *ArticleUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ArticleClient) Use

func (c *ArticleClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `article.Hooks(f(g(h())))`.

type ArticleCreate

type ArticleCreate struct {
	// contains filtered or unexported fields
}

ArticleCreate is the builder for creating a Article entity.

func (*ArticleCreate) AddCommentIDs

func (ac *ArticleCreate) AddCommentIDs(ids ...int) *ArticleCreate

AddCommentIDs adds the "comments" edge to the Comment entity by IDs.

func (*ArticleCreate) AddComments

func (ac *ArticleCreate) AddComments(c ...*Comment) *ArticleCreate

AddComments adds the "comments" edges to the Comment entity.

func (*ArticleCreate) Mutation

func (ac *ArticleCreate) Mutation() *ArticleMutation

Mutation returns the ArticleMutation object of the builder.

func (*ArticleCreate) Save

func (ac *ArticleCreate) Save(ctx context.Context) (*Article, error)

Save creates the Article in the database.

func (*ArticleCreate) SaveX

func (ac *ArticleCreate) SaveX(ctx context.Context) *Article

SaveX calls Save and panics if Save returns an error.

func (*ArticleCreate) SetAuthor

func (ac *ArticleCreate) SetAuthor(k *KhumuUser) *ArticleCreate

SetAuthor sets the "author" edge to the KhumuUser entity.

func (*ArticleCreate) SetAuthorID

func (ac *ArticleCreate) SetAuthorID(id string) *ArticleCreate

SetAuthorID sets the "author" edge to the KhumuUser entity by ID.

func (*ArticleCreate) SetCreatedAt

func (ac *ArticleCreate) SetCreatedAt(t time.Time) *ArticleCreate

SetCreatedAt sets the "created_at" field.

func (*ArticleCreate) SetID

func (ac *ArticleCreate) SetID(i int) *ArticleCreate

SetID sets the "id" field.

func (*ArticleCreate) SetImages

func (ac *ArticleCreate) SetImages(s *[]string) *ArticleCreate

SetImages sets the "images" field.

func (*ArticleCreate) SetNillableAuthorID

func (ac *ArticleCreate) SetNillableAuthorID(id *string) *ArticleCreate

SetNillableAuthorID sets the "author" edge to the KhumuUser entity by ID if the given value is not nil.

func (*ArticleCreate) SetNillableCreatedAt

func (ac *ArticleCreate) SetNillableCreatedAt(t *time.Time) *ArticleCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*ArticleCreate) SetNillableTitle

func (ac *ArticleCreate) SetNillableTitle(s *string) *ArticleCreate

SetNillableTitle sets the "title" field if the given value is not nil.

func (*ArticleCreate) SetTitle

func (ac *ArticleCreate) SetTitle(s string) *ArticleCreate

SetTitle sets the "title" field.

type ArticleCreateBulk

type ArticleCreateBulk struct {
	// contains filtered or unexported fields
}

ArticleCreateBulk is the builder for creating many Article entities in bulk.

func (*ArticleCreateBulk) Save

func (acb *ArticleCreateBulk) Save(ctx context.Context) ([]*Article, error)

Save creates the Article entities in the database.

func (*ArticleCreateBulk) SaveX

func (acb *ArticleCreateBulk) SaveX(ctx context.Context) []*Article

SaveX is like Save, but panics if an error occurs.

type ArticleDelete

type ArticleDelete struct {
	// contains filtered or unexported fields
}

ArticleDelete is the builder for deleting a Article entity.

func (*ArticleDelete) Exec

func (ad *ArticleDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*ArticleDelete) ExecX

func (ad *ArticleDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*ArticleDelete) Where

func (ad *ArticleDelete) Where(ps ...predicate.Article) *ArticleDelete

Where adds a new predicate to the ArticleDelete builder.

type ArticleDeleteOne

type ArticleDeleteOne struct {
	// contains filtered or unexported fields
}

ArticleDeleteOne is the builder for deleting a single Article entity.

func (*ArticleDeleteOne) Exec

func (ado *ArticleDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*ArticleDeleteOne) ExecX

func (ado *ArticleDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type ArticleEdges

type ArticleEdges struct {
	// Comments holds the value of the comments edge.
	Comments []*Comment `json:"comments,omitempty"`
	// Author holds the value of the author edge.
	Author *KhumuUser `json:"author,omitempty"`
	// contains filtered or unexported fields
}

ArticleEdges holds the relations/edges for other nodes in the graph.

func (ArticleEdges) AuthorOrErr

func (e ArticleEdges) AuthorOrErr() (*KhumuUser, error)

AuthorOrErr returns the Author value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (ArticleEdges) CommentsOrErr

func (e ArticleEdges) CommentsOrErr() ([]*Comment, error)

CommentsOrErr returns the Comments value or an error if the edge was not loaded in eager-loading.

type ArticleGroupBy

type ArticleGroupBy struct {
	// contains filtered or unexported fields
}

ArticleGroupBy is the group-by builder for Article entities.

func (*ArticleGroupBy) Aggregate

func (agb *ArticleGroupBy) Aggregate(fns ...AggregateFunc) *ArticleGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*ArticleGroupBy) Bool

func (agb *ArticleGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*ArticleGroupBy) BoolX

func (agb *ArticleGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*ArticleGroupBy) Bools

func (agb *ArticleGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*ArticleGroupBy) BoolsX

func (agb *ArticleGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*ArticleGroupBy) Float64

func (agb *ArticleGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*ArticleGroupBy) Float64X

func (agb *ArticleGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*ArticleGroupBy) Float64s

func (agb *ArticleGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*ArticleGroupBy) Float64sX

func (agb *ArticleGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*ArticleGroupBy) Int

func (agb *ArticleGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*ArticleGroupBy) IntX

func (agb *ArticleGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*ArticleGroupBy) Ints

func (agb *ArticleGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*ArticleGroupBy) IntsX

func (agb *ArticleGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*ArticleGroupBy) Scan

func (agb *ArticleGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*ArticleGroupBy) ScanX

func (agb *ArticleGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*ArticleGroupBy) String

func (agb *ArticleGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*ArticleGroupBy) StringX

func (agb *ArticleGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*ArticleGroupBy) Strings

func (agb *ArticleGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*ArticleGroupBy) StringsX

func (agb *ArticleGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type ArticleMutation

type ArticleMutation struct {
	// contains filtered or unexported fields
}

ArticleMutation represents an operation that mutates the Article nodes in the graph.

func (*ArticleMutation) AddCommentIDs

func (m *ArticleMutation) AddCommentIDs(ids ...int)

AddCommentIDs adds the "comments" edge to the Comment entity by ids.

func (*ArticleMutation) AddField

func (m *ArticleMutation) 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 (*ArticleMutation) AddedEdges

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

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

func (*ArticleMutation) AddedField

func (m *ArticleMutation) 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 (*ArticleMutation) AddedFields

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

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

func (*ArticleMutation) AddedIDs

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

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*ArticleMutation) AuthorCleared

func (m *ArticleMutation) AuthorCleared() bool

AuthorCleared reports if the "author" edge to the KhumuUser entity was cleared.

func (*ArticleMutation) AuthorID

func (m *ArticleMutation) AuthorID() (id string, exists bool)

AuthorID returns the "author" edge ID in the mutation.

func (*ArticleMutation) AuthorIDs

func (m *ArticleMutation) AuthorIDs() (ids []string)

AuthorIDs returns the "author" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use AuthorID instead. It exists only for internal usage by the builders.

func (*ArticleMutation) ClearAuthor

func (m *ArticleMutation) ClearAuthor()

ClearAuthor clears the "author" edge to the KhumuUser entity.

func (*ArticleMutation) ClearComments

func (m *ArticleMutation) ClearComments()

ClearComments clears the "comments" edge to the Comment entity.

func (*ArticleMutation) ClearEdge

func (m *ArticleMutation) 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 (*ArticleMutation) ClearField

func (m *ArticleMutation) 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 (*ArticleMutation) ClearImages

func (m *ArticleMutation) ClearImages()

ClearImages clears the value of the "images" field.

func (*ArticleMutation) ClearTitle

func (m *ArticleMutation) ClearTitle()

ClearTitle clears the value of the "title" field.

func (*ArticleMutation) ClearedEdges

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

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

func (*ArticleMutation) ClearedFields

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

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

func (ArticleMutation) Client

func (m ArticleMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*ArticleMutation) CommentsCleared

func (m *ArticleMutation) CommentsCleared() bool

CommentsCleared reports if the "comments" edge to the Comment entity was cleared.

func (*ArticleMutation) CommentsIDs

func (m *ArticleMutation) CommentsIDs() (ids []int)

CommentsIDs returns the "comments" edge IDs in the mutation.

func (*ArticleMutation) CreatedAt

func (m *ArticleMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*ArticleMutation) EdgeCleared

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

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*ArticleMutation) Field

func (m *ArticleMutation) 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 (*ArticleMutation) FieldCleared

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

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*ArticleMutation) Fields

func (m *ArticleMutation) 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 (*ArticleMutation) ID

func (m *ArticleMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder.

func (*ArticleMutation) Images

func (m *ArticleMutation) Images() (r *[]string, exists bool)

Images returns the value of the "images" field in the mutation.

func (*ArticleMutation) ImagesCleared

func (m *ArticleMutation) ImagesCleared() bool

ImagesCleared returns if the "images" field was cleared in this mutation.

func (*ArticleMutation) OldCreatedAt

func (m *ArticleMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the Article entity. If the Article object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*ArticleMutation) OldField

func (m *ArticleMutation) 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 (*ArticleMutation) OldImages

func (m *ArticleMutation) OldImages(ctx context.Context) (v *[]string, err error)

OldImages returns the old "images" field's value of the Article entity. If the Article object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*ArticleMutation) OldTitle

func (m *ArticleMutation) OldTitle(ctx context.Context) (v string, err error)

OldTitle returns the old "title" field's value of the Article entity. If the Article object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*ArticleMutation) Op

func (m *ArticleMutation) Op() Op

Op returns the operation name.

func (*ArticleMutation) RemoveCommentIDs

func (m *ArticleMutation) RemoveCommentIDs(ids ...int)

RemoveCommentIDs removes the "comments" edge to the Comment entity by IDs.

func (*ArticleMutation) RemovedCommentsIDs

func (m *ArticleMutation) RemovedCommentsIDs() (ids []int)

RemovedComments returns the removed IDs of the "comments" edge to the Comment entity.

func (*ArticleMutation) RemovedEdges

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

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

func (*ArticleMutation) RemovedIDs

func (m *ArticleMutation) 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 (*ArticleMutation) ResetAuthor

func (m *ArticleMutation) ResetAuthor()

ResetAuthor resets all changes to the "author" edge.

func (*ArticleMutation) ResetComments

func (m *ArticleMutation) ResetComments()

ResetComments resets all changes to the "comments" edge.

func (*ArticleMutation) ResetCreatedAt

func (m *ArticleMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*ArticleMutation) ResetEdge

func (m *ArticleMutation) 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 (*ArticleMutation) ResetField

func (m *ArticleMutation) 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 (*ArticleMutation) ResetImages

func (m *ArticleMutation) ResetImages()

ResetImages resets all changes to the "images" field.

func (*ArticleMutation) ResetTitle

func (m *ArticleMutation) ResetTitle()

ResetTitle resets all changes to the "title" field.

func (*ArticleMutation) SetAuthorID

func (m *ArticleMutation) SetAuthorID(id string)

SetAuthorID sets the "author" edge to the KhumuUser entity by id.

func (*ArticleMutation) SetCreatedAt

func (m *ArticleMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*ArticleMutation) SetField

func (m *ArticleMutation) 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 (*ArticleMutation) SetID

func (m *ArticleMutation) SetID(id int)

SetID sets the value of the id field. Note that this operation is only accepted on creation of Article entities.

func (*ArticleMutation) SetImages

func (m *ArticleMutation) SetImages(s *[]string)

SetImages sets the "images" field.

func (*ArticleMutation) SetTitle

func (m *ArticleMutation) SetTitle(s string)

SetTitle sets the "title" field.

func (*ArticleMutation) Title

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

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

func (*ArticleMutation) TitleCleared

func (m *ArticleMutation) TitleCleared() bool

TitleCleared returns if the "title" field was cleared in this mutation.

func (ArticleMutation) Tx

func (m ArticleMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*ArticleMutation) Type

func (m *ArticleMutation) Type() string

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

type ArticleQuery

type ArticleQuery struct {
	// contains filtered or unexported fields
}

ArticleQuery is the builder for querying Article entities.

func (*ArticleQuery) All

func (aq *ArticleQuery) All(ctx context.Context) ([]*Article, error)

All executes the query and returns a list of Articles.

func (*ArticleQuery) AllX

func (aq *ArticleQuery) AllX(ctx context.Context) []*Article

AllX is like All, but panics if an error occurs.

func (*ArticleQuery) Clone

func (aq *ArticleQuery) Clone() *ArticleQuery

Clone returns a duplicate of the ArticleQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*ArticleQuery) Count

func (aq *ArticleQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*ArticleQuery) CountX

func (aq *ArticleQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*ArticleQuery) Exist

func (aq *ArticleQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*ArticleQuery) ExistX

func (aq *ArticleQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*ArticleQuery) First

func (aq *ArticleQuery) First(ctx context.Context) (*Article, error)

First returns the first Article entity from the query. Returns a *NotFoundError when no Article was found.

func (*ArticleQuery) FirstID

func (aq *ArticleQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first Article ID from the query. Returns a *NotFoundError when no Article ID was found.

func (*ArticleQuery) FirstIDX

func (aq *ArticleQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*ArticleQuery) FirstX

func (aq *ArticleQuery) FirstX(ctx context.Context) *Article

FirstX is like First, but panics if an error occurs.

func (*ArticleQuery) GroupBy

func (aq *ArticleQuery) GroupBy(field string, fields ...string) *ArticleGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	Title string `json:"title,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Article.Query().
	GroupBy(article.FieldTitle).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ArticleQuery) IDs

func (aq *ArticleQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of Article IDs.

func (*ArticleQuery) IDsX

func (aq *ArticleQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*ArticleQuery) Limit

func (aq *ArticleQuery) Limit(limit int) *ArticleQuery

Limit adds a limit step to the query.

func (*ArticleQuery) Offset

func (aq *ArticleQuery) Offset(offset int) *ArticleQuery

Offset adds an offset step to the query.

func (*ArticleQuery) Only

func (aq *ArticleQuery) Only(ctx context.Context) (*Article, error)

Only returns a single Article entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one Article entity is not found. Returns a *NotFoundError when no Article entities are found.

func (*ArticleQuery) OnlyID

func (aq *ArticleQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only Article ID in the query. Returns a *NotSingularError when exactly one Article ID is not found. Returns a *NotFoundError when no entities are found.

func (*ArticleQuery) OnlyIDX

func (aq *ArticleQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*ArticleQuery) OnlyX

func (aq *ArticleQuery) OnlyX(ctx context.Context) *Article

OnlyX is like Only, but panics if an error occurs.

func (*ArticleQuery) Order

func (aq *ArticleQuery) Order(o ...OrderFunc) *ArticleQuery

Order adds an order step to the query.

func (*ArticleQuery) QueryAuthor

func (aq *ArticleQuery) QueryAuthor() *KhumuUserQuery

QueryAuthor chains the current query on the "author" edge.

func (*ArticleQuery) QueryComments

func (aq *ArticleQuery) QueryComments() *CommentQuery

QueryComments chains the current query on the "comments" edge.

func (*ArticleQuery) Select

func (aq *ArticleQuery) Select(field string, fields ...string) *ArticleSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	Title string `json:"title,omitempty"`
}

client.Article.Query().
	Select(article.FieldTitle).
	Scan(ctx, &v)

func (*ArticleQuery) Unique

func (aq *ArticleQuery) Unique(unique bool) *ArticleQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*ArticleQuery) Where

func (aq *ArticleQuery) Where(ps ...predicate.Article) *ArticleQuery

Where adds a new predicate for the ArticleQuery builder.

func (*ArticleQuery) WithAuthor

func (aq *ArticleQuery) WithAuthor(opts ...func(*KhumuUserQuery)) *ArticleQuery

WithAuthor tells the query-builder to eager-load the nodes that are connected to the "author" edge. The optional arguments are used to configure the query builder of the edge.

func (*ArticleQuery) WithComments

func (aq *ArticleQuery) WithComments(opts ...func(*CommentQuery)) *ArticleQuery

WithComments tells the query-builder to eager-load the nodes that are connected to the "comments" edge. The optional arguments are used to configure the query builder of the edge.

type ArticleSelect

type ArticleSelect struct {
	*ArticleQuery
	// contains filtered or unexported fields
}

ArticleSelect is the builder for selecting fields of Article entities.

func (*ArticleSelect) Bool

func (as *ArticleSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*ArticleSelect) BoolX

func (as *ArticleSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*ArticleSelect) Bools

func (as *ArticleSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*ArticleSelect) BoolsX

func (as *ArticleSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*ArticleSelect) Float64

func (as *ArticleSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*ArticleSelect) Float64X

func (as *ArticleSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*ArticleSelect) Float64s

func (as *ArticleSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*ArticleSelect) Float64sX

func (as *ArticleSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*ArticleSelect) Int

func (as *ArticleSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*ArticleSelect) IntX

func (as *ArticleSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*ArticleSelect) Ints

func (as *ArticleSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*ArticleSelect) IntsX

func (as *ArticleSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*ArticleSelect) Scan

func (as *ArticleSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*ArticleSelect) ScanX

func (as *ArticleSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*ArticleSelect) String

func (as *ArticleSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*ArticleSelect) StringX

func (as *ArticleSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*ArticleSelect) Strings

func (as *ArticleSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*ArticleSelect) StringsX

func (as *ArticleSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type ArticleUpdate

type ArticleUpdate struct {
	// contains filtered or unexported fields
}

ArticleUpdate is the builder for updating Article entities.

func (*ArticleUpdate) AddCommentIDs

func (au *ArticleUpdate) AddCommentIDs(ids ...int) *ArticleUpdate

AddCommentIDs adds the "comments" edge to the Comment entity by IDs.

func (*ArticleUpdate) AddComments

func (au *ArticleUpdate) AddComments(c ...*Comment) *ArticleUpdate

AddComments adds the "comments" edges to the Comment entity.

func (*ArticleUpdate) ClearAuthor

func (au *ArticleUpdate) ClearAuthor() *ArticleUpdate

ClearAuthor clears the "author" edge to the KhumuUser entity.

func (*ArticleUpdate) ClearComments

func (au *ArticleUpdate) ClearComments() *ArticleUpdate

ClearComments clears all "comments" edges to the Comment entity.

func (*ArticleUpdate) ClearImages

func (au *ArticleUpdate) ClearImages() *ArticleUpdate

ClearImages clears the value of the "images" field.

func (*ArticleUpdate) ClearTitle

func (au *ArticleUpdate) ClearTitle() *ArticleUpdate

ClearTitle clears the value of the "title" field.

func (*ArticleUpdate) Exec

func (au *ArticleUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*ArticleUpdate) ExecX

func (au *ArticleUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*ArticleUpdate) Mutation

func (au *ArticleUpdate) Mutation() *ArticleMutation

Mutation returns the ArticleMutation object of the builder.

func (*ArticleUpdate) RemoveCommentIDs

func (au *ArticleUpdate) RemoveCommentIDs(ids ...int) *ArticleUpdate

RemoveCommentIDs removes the "comments" edge to Comment entities by IDs.

func (*ArticleUpdate) RemoveComments

func (au *ArticleUpdate) RemoveComments(c ...*Comment) *ArticleUpdate

RemoveComments removes "comments" edges to Comment entities.

func (*ArticleUpdate) Save

func (au *ArticleUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*ArticleUpdate) SaveX

func (au *ArticleUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*ArticleUpdate) SetAuthor

func (au *ArticleUpdate) SetAuthor(k *KhumuUser) *ArticleUpdate

SetAuthor sets the "author" edge to the KhumuUser entity.

func (*ArticleUpdate) SetAuthorID

func (au *ArticleUpdate) SetAuthorID(id string) *ArticleUpdate

SetAuthorID sets the "author" edge to the KhumuUser entity by ID.

func (*ArticleUpdate) SetCreatedAt

func (au *ArticleUpdate) SetCreatedAt(t time.Time) *ArticleUpdate

SetCreatedAt sets the "created_at" field.

func (*ArticleUpdate) SetImages

func (au *ArticleUpdate) SetImages(s *[]string) *ArticleUpdate

SetImages sets the "images" field.

func (*ArticleUpdate) SetNillableAuthorID

func (au *ArticleUpdate) SetNillableAuthorID(id *string) *ArticleUpdate

SetNillableAuthorID sets the "author" edge to the KhumuUser entity by ID if the given value is not nil.

func (*ArticleUpdate) SetNillableCreatedAt

func (au *ArticleUpdate) SetNillableCreatedAt(t *time.Time) *ArticleUpdate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*ArticleUpdate) SetNillableTitle

func (au *ArticleUpdate) SetNillableTitle(s *string) *ArticleUpdate

SetNillableTitle sets the "title" field if the given value is not nil.

func (*ArticleUpdate) SetTitle

func (au *ArticleUpdate) SetTitle(s string) *ArticleUpdate

SetTitle sets the "title" field.

func (*ArticleUpdate) Where

func (au *ArticleUpdate) Where(ps ...predicate.Article) *ArticleUpdate

Where adds a new predicate for the ArticleUpdate builder.

type ArticleUpdateOne

type ArticleUpdateOne struct {
	// contains filtered or unexported fields
}

ArticleUpdateOne is the builder for updating a single Article entity.

func (*ArticleUpdateOne) AddCommentIDs

func (auo *ArticleUpdateOne) AddCommentIDs(ids ...int) *ArticleUpdateOne

AddCommentIDs adds the "comments" edge to the Comment entity by IDs.

func (*ArticleUpdateOne) AddComments

func (auo *ArticleUpdateOne) AddComments(c ...*Comment) *ArticleUpdateOne

AddComments adds the "comments" edges to the Comment entity.

func (*ArticleUpdateOne) ClearAuthor

func (auo *ArticleUpdateOne) ClearAuthor() *ArticleUpdateOne

ClearAuthor clears the "author" edge to the KhumuUser entity.

func (*ArticleUpdateOne) ClearComments

func (auo *ArticleUpdateOne) ClearComments() *ArticleUpdateOne

ClearComments clears all "comments" edges to the Comment entity.

func (*ArticleUpdateOne) ClearImages

func (auo *ArticleUpdateOne) ClearImages() *ArticleUpdateOne

ClearImages clears the value of the "images" field.

func (*ArticleUpdateOne) ClearTitle

func (auo *ArticleUpdateOne) ClearTitle() *ArticleUpdateOne

ClearTitle clears the value of the "title" field.

func (*ArticleUpdateOne) Exec

func (auo *ArticleUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*ArticleUpdateOne) ExecX

func (auo *ArticleUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*ArticleUpdateOne) Mutation

func (auo *ArticleUpdateOne) Mutation() *ArticleMutation

Mutation returns the ArticleMutation object of the builder.

func (*ArticleUpdateOne) RemoveCommentIDs

func (auo *ArticleUpdateOne) RemoveCommentIDs(ids ...int) *ArticleUpdateOne

RemoveCommentIDs removes the "comments" edge to Comment entities by IDs.

func (*ArticleUpdateOne) RemoveComments

func (auo *ArticleUpdateOne) RemoveComments(c ...*Comment) *ArticleUpdateOne

RemoveComments removes "comments" edges to Comment entities.

func (*ArticleUpdateOne) Save

func (auo *ArticleUpdateOne) Save(ctx context.Context) (*Article, error)

Save executes the query and returns the updated Article entity.

func (*ArticleUpdateOne) SaveX

func (auo *ArticleUpdateOne) SaveX(ctx context.Context) *Article

SaveX is like Save, but panics if an error occurs.

func (*ArticleUpdateOne) Select

func (auo *ArticleUpdateOne) Select(field string, fields ...string) *ArticleUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*ArticleUpdateOne) SetAuthor

func (auo *ArticleUpdateOne) SetAuthor(k *KhumuUser) *ArticleUpdateOne

SetAuthor sets the "author" edge to the KhumuUser entity.

func (*ArticleUpdateOne) SetAuthorID

func (auo *ArticleUpdateOne) SetAuthorID(id string) *ArticleUpdateOne

SetAuthorID sets the "author" edge to the KhumuUser entity by ID.

func (*ArticleUpdateOne) SetCreatedAt

func (auo *ArticleUpdateOne) SetCreatedAt(t time.Time) *ArticleUpdateOne

SetCreatedAt sets the "created_at" field.

func (*ArticleUpdateOne) SetImages

func (auo *ArticleUpdateOne) SetImages(s *[]string) *ArticleUpdateOne

SetImages sets the "images" field.

func (*ArticleUpdateOne) SetNillableAuthorID

func (auo *ArticleUpdateOne) SetNillableAuthorID(id *string) *ArticleUpdateOne

SetNillableAuthorID sets the "author" edge to the KhumuUser entity by ID if the given value is not nil.

func (*ArticleUpdateOne) SetNillableCreatedAt

func (auo *ArticleUpdateOne) SetNillableCreatedAt(t *time.Time) *ArticleUpdateOne

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*ArticleUpdateOne) SetNillableTitle

func (auo *ArticleUpdateOne) SetNillableTitle(s *string) *ArticleUpdateOne

SetNillableTitle sets the "title" field if the given value is not nil.

func (*ArticleUpdateOne) SetTitle

func (auo *ArticleUpdateOne) SetTitle(s string) *ArticleUpdateOne

SetTitle sets the "title" field.

type Articles

type Articles []*Article

Articles is a parsable slice of Article.

type Board

type Board struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// contains filtered or unexported fields
}

Board is the model entity for the Board schema.

func (*Board) String

func (b *Board) String() string

String implements the fmt.Stringer.

func (*Board) Unwrap

func (b *Board) Unwrap() *Board

Unwrap unwraps the Board entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*Board) Update

func (b *Board) Update() *BoardUpdateOne

Update returns a builder for updating this Board. Note that you need to call Board.Unwrap() before calling this method if this Board was returned from a transaction, and the transaction was committed or rolled back.

type BoardClient

type BoardClient struct {
	// contains filtered or unexported fields
}

BoardClient is a client for the Board schema.

func NewBoardClient

func NewBoardClient(c config) *BoardClient

NewBoardClient returns a client for the Board from the given config.

func (*BoardClient) Create

func (c *BoardClient) Create() *BoardCreate

Create returns a create builder for Board.

func (*BoardClient) CreateBulk

func (c *BoardClient) CreateBulk(builders ...*BoardCreate) *BoardCreateBulk

CreateBulk returns a builder for creating a bulk of Board entities.

func (*BoardClient) Delete

func (c *BoardClient) Delete() *BoardDelete

Delete returns a delete builder for Board.

func (*BoardClient) DeleteOne

func (c *BoardClient) DeleteOne(b *Board) *BoardDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*BoardClient) DeleteOneID

func (c *BoardClient) DeleteOneID(id int) *BoardDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*BoardClient) Get

func (c *BoardClient) Get(ctx context.Context, id int) (*Board, error)

Get returns a Board entity by its id.

func (*BoardClient) GetX

func (c *BoardClient) GetX(ctx context.Context, id int) *Board

GetX is like Get, but panics if an error occurs.

func (*BoardClient) Hooks

func (c *BoardClient) Hooks() []Hook

Hooks returns the client hooks.

func (*BoardClient) Query

func (c *BoardClient) Query() *BoardQuery

Query returns a query builder for Board.

func (*BoardClient) Update

func (c *BoardClient) Update() *BoardUpdate

Update returns an update builder for Board.

func (*BoardClient) UpdateOne

func (c *BoardClient) UpdateOne(b *Board) *BoardUpdateOne

UpdateOne returns an update builder for the given entity.

func (*BoardClient) UpdateOneID

func (c *BoardClient) UpdateOneID(id int) *BoardUpdateOne

UpdateOneID returns an update builder for the given id.

func (*BoardClient) Use

func (c *BoardClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `board.Hooks(f(g(h())))`.

type BoardCreate

type BoardCreate struct {
	// contains filtered or unexported fields
}

BoardCreate is the builder for creating a Board entity.

func (*BoardCreate) Mutation

func (bc *BoardCreate) Mutation() *BoardMutation

Mutation returns the BoardMutation object of the builder.

func (*BoardCreate) Save

func (bc *BoardCreate) Save(ctx context.Context) (*Board, error)

Save creates the Board in the database.

func (*BoardCreate) SaveX

func (bc *BoardCreate) SaveX(ctx context.Context) *Board

SaveX calls Save and panics if Save returns an error.

type BoardCreateBulk

type BoardCreateBulk struct {
	// contains filtered or unexported fields
}

BoardCreateBulk is the builder for creating many Board entities in bulk.

func (*BoardCreateBulk) Save

func (bcb *BoardCreateBulk) Save(ctx context.Context) ([]*Board, error)

Save creates the Board entities in the database.

func (*BoardCreateBulk) SaveX

func (bcb *BoardCreateBulk) SaveX(ctx context.Context) []*Board

SaveX is like Save, but panics if an error occurs.

type BoardDelete

type BoardDelete struct {
	// contains filtered or unexported fields
}

BoardDelete is the builder for deleting a Board entity.

func (*BoardDelete) Exec

func (bd *BoardDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*BoardDelete) ExecX

func (bd *BoardDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*BoardDelete) Where

func (bd *BoardDelete) Where(ps ...predicate.Board) *BoardDelete

Where adds a new predicate to the BoardDelete builder.

type BoardDeleteOne

type BoardDeleteOne struct {
	// contains filtered or unexported fields
}

BoardDeleteOne is the builder for deleting a single Board entity.

func (*BoardDeleteOne) Exec

func (bdo *BoardDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*BoardDeleteOne) ExecX

func (bdo *BoardDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type BoardGroupBy

type BoardGroupBy struct {
	// contains filtered or unexported fields
}

BoardGroupBy is the group-by builder for Board entities.

func (*BoardGroupBy) Aggregate

func (bgb *BoardGroupBy) Aggregate(fns ...AggregateFunc) *BoardGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*BoardGroupBy) Bool

func (bgb *BoardGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*BoardGroupBy) BoolX

func (bgb *BoardGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*BoardGroupBy) Bools

func (bgb *BoardGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*BoardGroupBy) BoolsX

func (bgb *BoardGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*BoardGroupBy) Float64

func (bgb *BoardGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*BoardGroupBy) Float64X

func (bgb *BoardGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*BoardGroupBy) Float64s

func (bgb *BoardGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*BoardGroupBy) Float64sX

func (bgb *BoardGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*BoardGroupBy) Int

func (bgb *BoardGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*BoardGroupBy) IntX

func (bgb *BoardGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*BoardGroupBy) Ints

func (bgb *BoardGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*BoardGroupBy) IntsX

func (bgb *BoardGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*BoardGroupBy) Scan

func (bgb *BoardGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*BoardGroupBy) ScanX

func (bgb *BoardGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*BoardGroupBy) String

func (bgb *BoardGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*BoardGroupBy) StringX

func (bgb *BoardGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*BoardGroupBy) Strings

func (bgb *BoardGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*BoardGroupBy) StringsX

func (bgb *BoardGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type BoardMutation

type BoardMutation struct {
	// contains filtered or unexported fields
}

BoardMutation represents an operation that mutates the Board nodes in the graph.

func (*BoardMutation) AddField

func (m *BoardMutation) 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 (*BoardMutation) AddedEdges

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

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

func (*BoardMutation) AddedField

func (m *BoardMutation) 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 (*BoardMutation) AddedFields

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

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

func (*BoardMutation) AddedIDs

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

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*BoardMutation) ClearEdge

func (m *BoardMutation) 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 (*BoardMutation) ClearField

func (m *BoardMutation) 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 (*BoardMutation) ClearedEdges

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

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

func (*BoardMutation) ClearedFields

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

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

func (BoardMutation) Client

func (m BoardMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*BoardMutation) EdgeCleared

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

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*BoardMutation) Field

func (m *BoardMutation) 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 (*BoardMutation) FieldCleared

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

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*BoardMutation) Fields

func (m *BoardMutation) 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 (*BoardMutation) ID

func (m *BoardMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder.

func (*BoardMutation) OldField

func (m *BoardMutation) 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 (*BoardMutation) Op

func (m *BoardMutation) Op() Op

Op returns the operation name.

func (*BoardMutation) RemovedEdges

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

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

func (*BoardMutation) RemovedIDs

func (m *BoardMutation) 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 (*BoardMutation) ResetEdge

func (m *BoardMutation) 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 (*BoardMutation) ResetField

func (m *BoardMutation) 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 (*BoardMutation) SetField

func (m *BoardMutation) 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 (BoardMutation) Tx

func (m BoardMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*BoardMutation) Type

func (m *BoardMutation) Type() string

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

type BoardQuery

type BoardQuery struct {
	// contains filtered or unexported fields
}

BoardQuery is the builder for querying Board entities.

func (*BoardQuery) All

func (bq *BoardQuery) All(ctx context.Context) ([]*Board, error)

All executes the query and returns a list of Boards.

func (*BoardQuery) AllX

func (bq *BoardQuery) AllX(ctx context.Context) []*Board

AllX is like All, but panics if an error occurs.

func (*BoardQuery) Clone

func (bq *BoardQuery) Clone() *BoardQuery

Clone returns a duplicate of the BoardQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*BoardQuery) Count

func (bq *BoardQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*BoardQuery) CountX

func (bq *BoardQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*BoardQuery) Exist

func (bq *BoardQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*BoardQuery) ExistX

func (bq *BoardQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*BoardQuery) First

func (bq *BoardQuery) First(ctx context.Context) (*Board, error)

First returns the first Board entity from the query. Returns a *NotFoundError when no Board was found.

func (*BoardQuery) FirstID

func (bq *BoardQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first Board ID from the query. Returns a *NotFoundError when no Board ID was found.

func (*BoardQuery) FirstIDX

func (bq *BoardQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*BoardQuery) FirstX

func (bq *BoardQuery) FirstX(ctx context.Context) *Board

FirstX is like First, but panics if an error occurs.

func (*BoardQuery) GroupBy

func (bq *BoardQuery) GroupBy(field string, fields ...string) *BoardGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

func (*BoardQuery) IDs

func (bq *BoardQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of Board IDs.

func (*BoardQuery) IDsX

func (bq *BoardQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*BoardQuery) Limit

func (bq *BoardQuery) Limit(limit int) *BoardQuery

Limit adds a limit step to the query.

func (*BoardQuery) Offset

func (bq *BoardQuery) Offset(offset int) *BoardQuery

Offset adds an offset step to the query.

func (*BoardQuery) Only

func (bq *BoardQuery) Only(ctx context.Context) (*Board, error)

Only returns a single Board entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one Board entity is not found. Returns a *NotFoundError when no Board entities are found.

func (*BoardQuery) OnlyID

func (bq *BoardQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only Board ID in the query. Returns a *NotSingularError when exactly one Board ID is not found. Returns a *NotFoundError when no entities are found.

func (*BoardQuery) OnlyIDX

func (bq *BoardQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*BoardQuery) OnlyX

func (bq *BoardQuery) OnlyX(ctx context.Context) *Board

OnlyX is like Only, but panics if an error occurs.

func (*BoardQuery) Order

func (bq *BoardQuery) Order(o ...OrderFunc) *BoardQuery

Order adds an order step to the query.

func (*BoardQuery) Select

func (bq *BoardQuery) Select(field string, fields ...string) *BoardSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

func (*BoardQuery) Unique

func (bq *BoardQuery) Unique(unique bool) *BoardQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*BoardQuery) Where

func (bq *BoardQuery) Where(ps ...predicate.Board) *BoardQuery

Where adds a new predicate for the BoardQuery builder.

type BoardSelect

type BoardSelect struct {
	*BoardQuery
	// contains filtered or unexported fields
}

BoardSelect is the builder for selecting fields of Board entities.

func (*BoardSelect) Bool

func (bs *BoardSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*BoardSelect) BoolX

func (bs *BoardSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*BoardSelect) Bools

func (bs *BoardSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*BoardSelect) BoolsX

func (bs *BoardSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*BoardSelect) Float64

func (bs *BoardSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*BoardSelect) Float64X

func (bs *BoardSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*BoardSelect) Float64s

func (bs *BoardSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*BoardSelect) Float64sX

func (bs *BoardSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*BoardSelect) Int

func (bs *BoardSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*BoardSelect) IntX

func (bs *BoardSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*BoardSelect) Ints

func (bs *BoardSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*BoardSelect) IntsX

func (bs *BoardSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*BoardSelect) Scan

func (bs *BoardSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*BoardSelect) ScanX

func (bs *BoardSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*BoardSelect) String

func (bs *BoardSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*BoardSelect) StringX

func (bs *BoardSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*BoardSelect) Strings

func (bs *BoardSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*BoardSelect) StringsX

func (bs *BoardSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type BoardUpdate

type BoardUpdate struct {
	// contains filtered or unexported fields
}

BoardUpdate is the builder for updating Board entities.

func (*BoardUpdate) Exec

func (bu *BoardUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*BoardUpdate) ExecX

func (bu *BoardUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*BoardUpdate) Mutation

func (bu *BoardUpdate) Mutation() *BoardMutation

Mutation returns the BoardMutation object of the builder.

func (*BoardUpdate) Save

func (bu *BoardUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*BoardUpdate) SaveX

func (bu *BoardUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*BoardUpdate) Where

func (bu *BoardUpdate) Where(ps ...predicate.Board) *BoardUpdate

Where adds a new predicate for the BoardUpdate builder.

type BoardUpdateOne

type BoardUpdateOne struct {
	// contains filtered or unexported fields
}

BoardUpdateOne is the builder for updating a single Board entity.

func (*BoardUpdateOne) Exec

func (buo *BoardUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*BoardUpdateOne) ExecX

func (buo *BoardUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*BoardUpdateOne) Mutation

func (buo *BoardUpdateOne) Mutation() *BoardMutation

Mutation returns the BoardMutation object of the builder.

func (*BoardUpdateOne) Save

func (buo *BoardUpdateOne) Save(ctx context.Context) (*Board, error)

Save executes the query and returns the updated Board entity.

func (*BoardUpdateOne) SaveX

func (buo *BoardUpdateOne) SaveX(ctx context.Context) *Board

SaveX is like Save, but panics if an error occurs.

func (*BoardUpdateOne) Select

func (buo *BoardUpdateOne) Select(field string, fields ...string) *BoardUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

type Boards

type Boards []*Board

Boards is a parsable slice of Board.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Article is the client for interacting with the Article builders.
	Article *ArticleClient
	// Board is the client for interacting with the Board builders.
	Board *BoardClient
	// Comment is the client for interacting with the Comment builders.
	Comment *CommentClient
	// KhumuUser is the client for interacting with the KhumuUser builders.
	KhumuUser *KhumuUserClient
	// LikeComment is the client for interacting with the LikeComment builders.
	LikeComment *LikeCommentClient
	// StudyArticle is the client for interacting with the StudyArticle builders.
	StudyArticle *StudyArticleClient
	// contains filtered or unexported fields
}

Client is the client that holds all ent builders.

func FromContext

func FromContext(ctx context.Context) *Client

FromContext returns a Client stored inside a context, or nil if there isn't one.

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new client configured with the given options.

func Open

func Open(driverName, dataSourceName string, options ...Option) (*Client, error)

Open opens a database/sql.DB specified by the driver name and the data source name, and returns a new client attached to it. Optional parameters can be added for configuring the client.

func (*Client) BeginTx

func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)

BeginTx returns a transactional client with specified options.

func (*Client) Close

func (c *Client) Close() error

Close closes the database connection and prevents new queries from starting.

func (*Client) Debug

func (c *Client) Debug() *Client

Debug returns a new debug-client. It's used to get verbose logging on specific operations.

client.Debug().
	Article.
	Query().
	Count(ctx)

func (*Client) Tx

func (c *Client) Tx(ctx context.Context) (*Tx, error)

Tx returns a new transactional client. The provided context is used until the transaction is committed or rolled back.

func (*Client) Use

func (c *Client) Use(hooks ...Hook)

Use adds the mutation hooks to all the entity clients. In order to add hooks to a specific client, call: `client.Node.Use(...)`.

type Comment

type Comment struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// State holds the value of the "state" field.
	State string `json:"state,omitempty"`
	// Content holds the value of the "content" field.
	Content string `json:"content,omitempty"`
	// Kind holds the value of the "kind" field.
	Kind string `json:"kind,omitempty"`
	// IsWrittenByArticleAuthor holds the value of the "is_written_by_article_author" field.
	IsWrittenByArticleAuthor bool `json:"is_written_by_article_author,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the CommentQuery when eager-loading is set.
	Edges CommentEdges `json:"edges"`
	// contains filtered or unexported fields
}

Comment is the model entity for the Comment schema.

func (*Comment) QueryArticle

func (c *Comment) QueryArticle() *ArticleQuery

QueryArticle queries the "article" edge of the Comment entity.

func (*Comment) QueryAuthor

func (c *Comment) QueryAuthor() *KhumuUserQuery

QueryAuthor queries the "author" edge of the Comment entity.

func (*Comment) QueryChildren

func (c *Comment) QueryChildren() *CommentQuery

QueryChildren queries the "children" edge of the Comment entity.

func (*Comment) QueryLike

func (c *Comment) QueryLike() *LikeCommentQuery

QueryLike queries the "like" edge of the Comment entity.

func (*Comment) QueryParent

func (c *Comment) QueryParent() *CommentQuery

QueryParent queries the "parent" edge of the Comment entity.

func (*Comment) QueryStudyArticle

func (c *Comment) QueryStudyArticle() *StudyArticleQuery

QueryStudyArticle queries the "studyArticle" edge of the Comment entity.

func (*Comment) String

func (c *Comment) String() string

String implements the fmt.Stringer.

func (*Comment) Unwrap

func (c *Comment) Unwrap() *Comment

Unwrap unwraps the Comment entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*Comment) Update

func (c *Comment) Update() *CommentUpdateOne

Update returns a builder for updating this Comment. Note that you need to call Comment.Unwrap() before calling this method if this Comment was returned from a transaction, and the transaction was committed or rolled back.

type CommentClient

type CommentClient struct {
	// contains filtered or unexported fields
}

CommentClient is a client for the Comment schema.

func NewCommentClient

func NewCommentClient(c config) *CommentClient

NewCommentClient returns a client for the Comment from the given config.

func (*CommentClient) Create

func (c *CommentClient) Create() *CommentCreate

Create returns a create builder for Comment.

func (*CommentClient) CreateBulk

func (c *CommentClient) CreateBulk(builders ...*CommentCreate) *CommentCreateBulk

CreateBulk returns a builder for creating a bulk of Comment entities.

func (*CommentClient) Delete

func (c *CommentClient) Delete() *CommentDelete

Delete returns a delete builder for Comment.

func (*CommentClient) DeleteOne

func (c *CommentClient) DeleteOne(co *Comment) *CommentDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*CommentClient) DeleteOneID

func (c *CommentClient) DeleteOneID(id int) *CommentDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*CommentClient) Get

func (c *CommentClient) Get(ctx context.Context, id int) (*Comment, error)

Get returns a Comment entity by its id.

func (*CommentClient) GetX

func (c *CommentClient) GetX(ctx context.Context, id int) *Comment

GetX is like Get, but panics if an error occurs.

func (*CommentClient) Hooks

func (c *CommentClient) Hooks() []Hook

Hooks returns the client hooks.

func (*CommentClient) Query

func (c *CommentClient) Query() *CommentQuery

Query returns a query builder for Comment.

func (*CommentClient) QueryArticle

func (c *CommentClient) QueryArticle(co *Comment) *ArticleQuery

QueryArticle queries the article edge of a Comment.

func (*CommentClient) QueryAuthor

func (c *CommentClient) QueryAuthor(co *Comment) *KhumuUserQuery

QueryAuthor queries the author edge of a Comment.

func (*CommentClient) QueryChildren

func (c *CommentClient) QueryChildren(co *Comment) *CommentQuery

QueryChildren queries the children edge of a Comment.

func (*CommentClient) QueryLike

func (c *CommentClient) QueryLike(co *Comment) *LikeCommentQuery

QueryLike queries the like edge of a Comment.

func (*CommentClient) QueryParent

func (c *CommentClient) QueryParent(co *Comment) *CommentQuery

QueryParent queries the parent edge of a Comment.

func (*CommentClient) QueryStudyArticle

func (c *CommentClient) QueryStudyArticle(co *Comment) *StudyArticleQuery

QueryStudyArticle queries the studyArticle edge of a Comment.

func (*CommentClient) Update

func (c *CommentClient) Update() *CommentUpdate

Update returns an update builder for Comment.

func (*CommentClient) UpdateOne

func (c *CommentClient) UpdateOne(co *Comment) *CommentUpdateOne

UpdateOne returns an update builder for the given entity.

func (*CommentClient) UpdateOneID

func (c *CommentClient) UpdateOneID(id int) *CommentUpdateOne

UpdateOneID returns an update builder for the given id.

func (*CommentClient) Use

func (c *CommentClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `comment.Hooks(f(g(h())))`.

type CommentCreate

type CommentCreate struct {
	// contains filtered or unexported fields
}

CommentCreate is the builder for creating a Comment entity.

func (*CommentCreate) AddChildIDs

func (cc *CommentCreate) AddChildIDs(ids ...int) *CommentCreate

AddChildIDs adds the "children" edge to the Comment entity by IDs.

func (*CommentCreate) AddChildren

func (cc *CommentCreate) AddChildren(c ...*Comment) *CommentCreate

AddChildren adds the "children" edges to the Comment entity.

func (*CommentCreate) AddLike

func (cc *CommentCreate) AddLike(l ...*LikeComment) *CommentCreate

AddLike adds the "like" edges to the LikeComment entity.

func (*CommentCreate) AddLikeIDs

func (cc *CommentCreate) AddLikeIDs(ids ...int) *CommentCreate

AddLikeIDs adds the "like" edge to the LikeComment entity by IDs.

func (*CommentCreate) Mutation

func (cc *CommentCreate) Mutation() *CommentMutation

Mutation returns the CommentMutation object of the builder.

func (*CommentCreate) Save

func (cc *CommentCreate) Save(ctx context.Context) (*Comment, error)

Save creates the Comment in the database.

func (*CommentCreate) SaveX

func (cc *CommentCreate) SaveX(ctx context.Context) *Comment

SaveX calls Save and panics if Save returns an error.

func (*CommentCreate) SetArticle

func (cc *CommentCreate) SetArticle(a *Article) *CommentCreate

SetArticle sets the "article" edge to the Article entity.

func (*CommentCreate) SetArticleID

func (cc *CommentCreate) SetArticleID(id int) *CommentCreate

SetArticleID sets the "article" edge to the Article entity by ID.

func (*CommentCreate) SetAuthor

func (cc *CommentCreate) SetAuthor(k *KhumuUser) *CommentCreate

SetAuthor sets the "author" edge to the KhumuUser entity.

func (*CommentCreate) SetAuthorID

func (cc *CommentCreate) SetAuthorID(id string) *CommentCreate

SetAuthorID sets the "author" edge to the KhumuUser entity by ID.

func (*CommentCreate) SetContent

func (cc *CommentCreate) SetContent(s string) *CommentCreate

SetContent sets the "content" field.

func (*CommentCreate) SetCreatedAt

func (cc *CommentCreate) SetCreatedAt(t time.Time) *CommentCreate

SetCreatedAt sets the "created_at" field.

func (*CommentCreate) SetID

func (cc *CommentCreate) SetID(i int) *CommentCreate

SetID sets the "id" field.

func (*CommentCreate) SetIsWrittenByArticleAuthor

func (cc *CommentCreate) SetIsWrittenByArticleAuthor(b bool) *CommentCreate

SetIsWrittenByArticleAuthor sets the "is_written_by_article_author" field.

func (*CommentCreate) SetKind

func (cc *CommentCreate) SetKind(s string) *CommentCreate

SetKind sets the "kind" field.

func (*CommentCreate) SetNillableArticleID

func (cc *CommentCreate) SetNillableArticleID(id *int) *CommentCreate

SetNillableArticleID sets the "article" edge to the Article entity by ID if the given value is not nil.

func (*CommentCreate) SetNillableAuthorID

func (cc *CommentCreate) SetNillableAuthorID(id *string) *CommentCreate

SetNillableAuthorID sets the "author" edge to the KhumuUser entity by ID if the given value is not nil.

func (*CommentCreate) SetNillableCreatedAt

func (cc *CommentCreate) SetNillableCreatedAt(t *time.Time) *CommentCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*CommentCreate) SetNillableIsWrittenByArticleAuthor

func (cc *CommentCreate) SetNillableIsWrittenByArticleAuthor(b *bool) *CommentCreate

SetNillableIsWrittenByArticleAuthor sets the "is_written_by_article_author" field if the given value is not nil.

func (*CommentCreate) SetNillableKind

func (cc *CommentCreate) SetNillableKind(s *string) *CommentCreate

SetNillableKind sets the "kind" field if the given value is not nil.

func (*CommentCreate) SetNillableParentID

func (cc *CommentCreate) SetNillableParentID(id *int) *CommentCreate

SetNillableParentID sets the "parent" edge to the Comment entity by ID if the given value is not nil.

func (*CommentCreate) SetNillableState

func (cc *CommentCreate) SetNillableState(s *string) *CommentCreate

SetNillableState sets the "state" field if the given value is not nil.

func (*CommentCreate) SetNillableStudyArticleID

func (cc *CommentCreate) SetNillableStudyArticleID(id *int) *CommentCreate

SetNillableStudyArticleID sets the "studyArticle" edge to the StudyArticle entity by ID if the given value is not nil.

func (*CommentCreate) SetParent

func (cc *CommentCreate) SetParent(c *Comment) *CommentCreate

SetParent sets the "parent" edge to the Comment entity.

func (*CommentCreate) SetParentID

func (cc *CommentCreate) SetParentID(id int) *CommentCreate

SetParentID sets the "parent" edge to the Comment entity by ID.

func (*CommentCreate) SetState

func (cc *CommentCreate) SetState(s string) *CommentCreate

SetState sets the "state" field.

func (*CommentCreate) SetStudyArticle

func (cc *CommentCreate) SetStudyArticle(s *StudyArticle) *CommentCreate

SetStudyArticle sets the "studyArticle" edge to the StudyArticle entity.

func (*CommentCreate) SetStudyArticleID

func (cc *CommentCreate) SetStudyArticleID(id int) *CommentCreate

SetStudyArticleID sets the "studyArticle" edge to the StudyArticle entity by ID.

type CommentCreateBulk

type CommentCreateBulk struct {
	// contains filtered or unexported fields
}

CommentCreateBulk is the builder for creating many Comment entities in bulk.

func (*CommentCreateBulk) Save

func (ccb *CommentCreateBulk) Save(ctx context.Context) ([]*Comment, error)

Save creates the Comment entities in the database.

func (*CommentCreateBulk) SaveX

func (ccb *CommentCreateBulk) SaveX(ctx context.Context) []*Comment

SaveX is like Save, but panics if an error occurs.

type CommentDelete

type CommentDelete struct {
	// contains filtered or unexported fields
}

CommentDelete is the builder for deleting a Comment entity.

func (*CommentDelete) Exec

func (cd *CommentDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*CommentDelete) ExecX

func (cd *CommentDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*CommentDelete) Where

func (cd *CommentDelete) Where(ps ...predicate.Comment) *CommentDelete

Where adds a new predicate to the CommentDelete builder.

type CommentDeleteOne

type CommentDeleteOne struct {
	// contains filtered or unexported fields
}

CommentDeleteOne is the builder for deleting a single Comment entity.

func (*CommentDeleteOne) Exec

func (cdo *CommentDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*CommentDeleteOne) ExecX

func (cdo *CommentDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type CommentEdges

type CommentEdges struct {
	// Author holds the value of the author edge.
	Author *KhumuUser `json:"author,omitempty"`
	// Article holds the value of the article edge.
	Article *Article `json:"article,omitempty"`
	// StudyArticle holds the value of the studyArticle edge.
	StudyArticle *StudyArticle `json:"studyArticle,omitempty"`
	// Parent holds the value of the parent edge.
	Parent *Comment `json:"parent,omitempty"`
	// Children holds the value of the children edge.
	Children []*Comment `json:"children,omitempty"`
	// Like holds the value of the like edge.
	Like []*LikeComment `json:"like,omitempty"`
	// contains filtered or unexported fields
}

CommentEdges holds the relations/edges for other nodes in the graph.

func (CommentEdges) ArticleOrErr

func (e CommentEdges) ArticleOrErr() (*Article, error)

ArticleOrErr returns the Article value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (CommentEdges) AuthorOrErr

func (e CommentEdges) AuthorOrErr() (*KhumuUser, error)

AuthorOrErr returns the Author value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (CommentEdges) ChildrenOrErr

func (e CommentEdges) ChildrenOrErr() ([]*Comment, error)

ChildrenOrErr returns the Children value or an error if the edge was not loaded in eager-loading.

func (CommentEdges) LikeOrErr

func (e CommentEdges) LikeOrErr() ([]*LikeComment, error)

LikeOrErr returns the Like value or an error if the edge was not loaded in eager-loading.

func (CommentEdges) ParentOrErr

func (e CommentEdges) ParentOrErr() (*Comment, error)

ParentOrErr returns the Parent value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (CommentEdges) StudyArticleOrErr

func (e CommentEdges) StudyArticleOrErr() (*StudyArticle, error)

StudyArticleOrErr returns the StudyArticle value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

type CommentGroupBy

type CommentGroupBy struct {
	// contains filtered or unexported fields
}

CommentGroupBy is the group-by builder for Comment entities.

func (*CommentGroupBy) Aggregate

func (cgb *CommentGroupBy) Aggregate(fns ...AggregateFunc) *CommentGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*CommentGroupBy) Bool

func (cgb *CommentGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*CommentGroupBy) BoolX

func (cgb *CommentGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*CommentGroupBy) Bools

func (cgb *CommentGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*CommentGroupBy) BoolsX

func (cgb *CommentGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*CommentGroupBy) Float64

func (cgb *CommentGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*CommentGroupBy) Float64X

func (cgb *CommentGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*CommentGroupBy) Float64s

func (cgb *CommentGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*CommentGroupBy) Float64sX

func (cgb *CommentGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*CommentGroupBy) Int

func (cgb *CommentGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*CommentGroupBy) IntX

func (cgb *CommentGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*CommentGroupBy) Ints

func (cgb *CommentGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*CommentGroupBy) IntsX

func (cgb *CommentGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*CommentGroupBy) Scan

func (cgb *CommentGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*CommentGroupBy) ScanX

func (cgb *CommentGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*CommentGroupBy) String

func (cgb *CommentGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*CommentGroupBy) StringX

func (cgb *CommentGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*CommentGroupBy) Strings

func (cgb *CommentGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*CommentGroupBy) StringsX

func (cgb *CommentGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type CommentMutation

type CommentMutation struct {
	// contains filtered or unexported fields
}

CommentMutation represents an operation that mutates the Comment nodes in the graph.

func (*CommentMutation) AddChildIDs

func (m *CommentMutation) AddChildIDs(ids ...int)

AddChildIDs adds the "children" edge to the Comment entity by ids.

func (*CommentMutation) AddField

func (m *CommentMutation) 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 (*CommentMutation) AddLikeIDs

func (m *CommentMutation) AddLikeIDs(ids ...int)

AddLikeIDs adds the "like" edge to the LikeComment entity by ids.

func (*CommentMutation) AddedEdges

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

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

func (*CommentMutation) AddedField

func (m *CommentMutation) 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 (*CommentMutation) AddedFields

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

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

func (*CommentMutation) AddedIDs

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

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*CommentMutation) ArticleCleared

func (m *CommentMutation) ArticleCleared() bool

ArticleCleared reports if the "article" edge to the Article entity was cleared.

func (*CommentMutation) ArticleID

func (m *CommentMutation) ArticleID() (id int, exists bool)

ArticleID returns the "article" edge ID in the mutation.

func (*CommentMutation) ArticleIDs

func (m *CommentMutation) ArticleIDs() (ids []int)

ArticleIDs returns the "article" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use ArticleID instead. It exists only for internal usage by the builders.

func (*CommentMutation) AuthorCleared

func (m *CommentMutation) AuthorCleared() bool

AuthorCleared reports if the "author" edge to the KhumuUser entity was cleared.

func (*CommentMutation) AuthorID

func (m *CommentMutation) AuthorID() (id string, exists bool)

AuthorID returns the "author" edge ID in the mutation.

func (*CommentMutation) AuthorIDs

func (m *CommentMutation) AuthorIDs() (ids []string)

AuthorIDs returns the "author" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use AuthorID instead. It exists only for internal usage by the builders.

func (*CommentMutation) ChildrenCleared

func (m *CommentMutation) ChildrenCleared() bool

ChildrenCleared reports if the "children" edge to the Comment entity was cleared.

func (*CommentMutation) ChildrenIDs

func (m *CommentMutation) ChildrenIDs() (ids []int)

ChildrenIDs returns the "children" edge IDs in the mutation.

func (*CommentMutation) ClearArticle

func (m *CommentMutation) ClearArticle()

ClearArticle clears the "article" edge to the Article entity.

func (*CommentMutation) ClearAuthor

func (m *CommentMutation) ClearAuthor()

ClearAuthor clears the "author" edge to the KhumuUser entity.

func (*CommentMutation) ClearChildren

func (m *CommentMutation) ClearChildren()

ClearChildren clears the "children" edge to the Comment entity.

func (*CommentMutation) ClearEdge

func (m *CommentMutation) 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 (*CommentMutation) ClearField

func (m *CommentMutation) 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 (*CommentMutation) ClearLike

func (m *CommentMutation) ClearLike()

ClearLike clears the "like" edge to the LikeComment entity.

func (*CommentMutation) ClearParent

func (m *CommentMutation) ClearParent()

ClearParent clears the "parent" edge to the Comment entity.

func (*CommentMutation) ClearStudyArticle

func (m *CommentMutation) ClearStudyArticle()

ClearStudyArticle clears the "studyArticle" edge to the StudyArticle entity.

func (*CommentMutation) ClearedEdges

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

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

func (*CommentMutation) ClearedFields

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

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

func (CommentMutation) Client

func (m CommentMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*CommentMutation) Content

func (m *CommentMutation) Content() (r string, exists bool)

Content returns the value of the "content" field in the mutation.

func (*CommentMutation) CreatedAt

func (m *CommentMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*CommentMutation) EdgeCleared

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

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*CommentMutation) Field

func (m *CommentMutation) 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 (*CommentMutation) FieldCleared

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

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*CommentMutation) Fields

func (m *CommentMutation) 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 (*CommentMutation) ID

func (m *CommentMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder.

func (*CommentMutation) IsWrittenByArticleAuthor

func (m *CommentMutation) IsWrittenByArticleAuthor() (r bool, exists bool)

IsWrittenByArticleAuthor returns the value of the "is_written_by_article_author" field in the mutation.

func (*CommentMutation) Kind

func (m *CommentMutation) Kind() (r string, exists bool)

Kind returns the value of the "kind" field in the mutation.

func (*CommentMutation) LikeCleared

func (m *CommentMutation) LikeCleared() bool

LikeCleared reports if the "like" edge to the LikeComment entity was cleared.

func (*CommentMutation) LikeIDs

func (m *CommentMutation) LikeIDs() (ids []int)

LikeIDs returns the "like" edge IDs in the mutation.

func (*CommentMutation) OldContent

func (m *CommentMutation) OldContent(ctx context.Context) (v string, err error)

OldContent returns the old "content" field's value of the Comment entity. If the Comment object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*CommentMutation) OldCreatedAt

func (m *CommentMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the Comment entity. If the Comment object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*CommentMutation) OldField

func (m *CommentMutation) 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 (*CommentMutation) OldIsWrittenByArticleAuthor

func (m *CommentMutation) OldIsWrittenByArticleAuthor(ctx context.Context) (v bool, err error)

OldIsWrittenByArticleAuthor returns the old "is_written_by_article_author" field's value of the Comment entity. If the Comment object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*CommentMutation) OldKind

func (m *CommentMutation) OldKind(ctx context.Context) (v string, err error)

OldKind returns the old "kind" field's value of the Comment entity. If the Comment object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*CommentMutation) OldState

func (m *CommentMutation) OldState(ctx context.Context) (v string, err error)

OldState returns the old "state" field's value of the Comment entity. If the Comment object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*CommentMutation) Op

func (m *CommentMutation) Op() Op

Op returns the operation name.

func (*CommentMutation) ParentCleared

func (m *CommentMutation) ParentCleared() bool

ParentCleared reports if the "parent" edge to the Comment entity was cleared.

func (*CommentMutation) ParentID

func (m *CommentMutation) ParentID() (id int, exists bool)

ParentID returns the "parent" edge ID in the mutation.

func (*CommentMutation) ParentIDs

func (m *CommentMutation) ParentIDs() (ids []int)

ParentIDs returns the "parent" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use ParentID instead. It exists only for internal usage by the builders.

func (*CommentMutation) RemoveChildIDs

func (m *CommentMutation) RemoveChildIDs(ids ...int)

RemoveChildIDs removes the "children" edge to the Comment entity by IDs.

func (*CommentMutation) RemoveLikeIDs

func (m *CommentMutation) RemoveLikeIDs(ids ...int)

RemoveLikeIDs removes the "like" edge to the LikeComment entity by IDs.

func (*CommentMutation) RemovedChildrenIDs

func (m *CommentMutation) RemovedChildrenIDs() (ids []int)

RemovedChildren returns the removed IDs of the "children" edge to the Comment entity.

func (*CommentMutation) RemovedEdges

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

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

func (*CommentMutation) RemovedIDs

func (m *CommentMutation) 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 (*CommentMutation) RemovedLikeIDs

func (m *CommentMutation) RemovedLikeIDs() (ids []int)

RemovedLike returns the removed IDs of the "like" edge to the LikeComment entity.

func (*CommentMutation) ResetArticle

func (m *CommentMutation) ResetArticle()

ResetArticle resets all changes to the "article" edge.

func (*CommentMutation) ResetAuthor

func (m *CommentMutation) ResetAuthor()

ResetAuthor resets all changes to the "author" edge.

func (*CommentMutation) ResetChildren

func (m *CommentMutation) ResetChildren()

ResetChildren resets all changes to the "children" edge.

func (*CommentMutation) ResetContent

func (m *CommentMutation) ResetContent()

ResetContent resets all changes to the "content" field.

func (*CommentMutation) ResetCreatedAt

func (m *CommentMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*CommentMutation) ResetEdge

func (m *CommentMutation) 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 (*CommentMutation) ResetField

func (m *CommentMutation) 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 (*CommentMutation) ResetIsWrittenByArticleAuthor

func (m *CommentMutation) ResetIsWrittenByArticleAuthor()

ResetIsWrittenByArticleAuthor resets all changes to the "is_written_by_article_author" field.

func (*CommentMutation) ResetKind

func (m *CommentMutation) ResetKind()

ResetKind resets all changes to the "kind" field.

func (*CommentMutation) ResetLike

func (m *CommentMutation) ResetLike()

ResetLike resets all changes to the "like" edge.

func (*CommentMutation) ResetParent

func (m *CommentMutation) ResetParent()

ResetParent resets all changes to the "parent" edge.

func (*CommentMutation) ResetState

func (m *CommentMutation) ResetState()

ResetState resets all changes to the "state" field.

func (*CommentMutation) ResetStudyArticle

func (m *CommentMutation) ResetStudyArticle()

ResetStudyArticle resets all changes to the "studyArticle" edge.

func (*CommentMutation) SetArticleID

func (m *CommentMutation) SetArticleID(id int)

SetArticleID sets the "article" edge to the Article entity by id.

func (*CommentMutation) SetAuthorID

func (m *CommentMutation) SetAuthorID(id string)

SetAuthorID sets the "author" edge to the KhumuUser entity by id.

func (*CommentMutation) SetContent

func (m *CommentMutation) SetContent(s string)

SetContent sets the "content" field.

func (*CommentMutation) SetCreatedAt

func (m *CommentMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*CommentMutation) SetField

func (m *CommentMutation) 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 (*CommentMutation) SetID

func (m *CommentMutation) SetID(id int)

SetID sets the value of the id field. Note that this operation is only accepted on creation of Comment entities.

func (*CommentMutation) SetIsWrittenByArticleAuthor

func (m *CommentMutation) SetIsWrittenByArticleAuthor(b bool)

SetIsWrittenByArticleAuthor sets the "is_written_by_article_author" field.

func (*CommentMutation) SetKind

func (m *CommentMutation) SetKind(s string)

SetKind sets the "kind" field.

func (*CommentMutation) SetParentID

func (m *CommentMutation) SetParentID(id int)

SetParentID sets the "parent" edge to the Comment entity by id.

func (*CommentMutation) SetState

func (m *CommentMutation) SetState(s string)

SetState sets the "state" field.

func (*CommentMutation) SetStudyArticleID

func (m *CommentMutation) SetStudyArticleID(id int)

SetStudyArticleID sets the "studyArticle" edge to the StudyArticle entity by id.

func (*CommentMutation) State

func (m *CommentMutation) State() (r string, exists bool)

State returns the value of the "state" field in the mutation.

func (*CommentMutation) StudyArticleCleared

func (m *CommentMutation) StudyArticleCleared() bool

StudyArticleCleared reports if the "studyArticle" edge to the StudyArticle entity was cleared.

func (*CommentMutation) StudyArticleID

func (m *CommentMutation) StudyArticleID() (id int, exists bool)

StudyArticleID returns the "studyArticle" edge ID in the mutation.

func (*CommentMutation) StudyArticleIDs

func (m *CommentMutation) StudyArticleIDs() (ids []int)

StudyArticleIDs returns the "studyArticle" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use StudyArticleID instead. It exists only for internal usage by the builders.

func (CommentMutation) Tx

func (m CommentMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*CommentMutation) Type

func (m *CommentMutation) Type() string

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

type CommentQuery

type CommentQuery struct {
	// contains filtered or unexported fields
}

CommentQuery is the builder for querying Comment entities.

func (*CommentQuery) All

func (cq *CommentQuery) All(ctx context.Context) ([]*Comment, error)

All executes the query and returns a list of Comments.

func (*CommentQuery) AllX

func (cq *CommentQuery) AllX(ctx context.Context) []*Comment

AllX is like All, but panics if an error occurs.

func (*CommentQuery) Clone

func (cq *CommentQuery) Clone() *CommentQuery

Clone returns a duplicate of the CommentQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*CommentQuery) Count

func (cq *CommentQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*CommentQuery) CountX

func (cq *CommentQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*CommentQuery) Exist

func (cq *CommentQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*CommentQuery) ExistX

func (cq *CommentQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*CommentQuery) First

func (cq *CommentQuery) First(ctx context.Context) (*Comment, error)

First returns the first Comment entity from the query. Returns a *NotFoundError when no Comment was found.

func (*CommentQuery) FirstID

func (cq *CommentQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first Comment ID from the query. Returns a *NotFoundError when no Comment ID was found.

func (*CommentQuery) FirstIDX

func (cq *CommentQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*CommentQuery) FirstX

func (cq *CommentQuery) FirstX(ctx context.Context) *Comment

FirstX is like First, but panics if an error occurs.

func (*CommentQuery) GroupBy

func (cq *CommentQuery) GroupBy(field string, fields ...string) *CommentGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	State string `json:"state,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Comment.Query().
	GroupBy(comment.FieldState).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*CommentQuery) IDs

func (cq *CommentQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of Comment IDs.

func (*CommentQuery) IDsX

func (cq *CommentQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*CommentQuery) Limit

func (cq *CommentQuery) Limit(limit int) *CommentQuery

Limit adds a limit step to the query.

func (*CommentQuery) Offset

func (cq *CommentQuery) Offset(offset int) *CommentQuery

Offset adds an offset step to the query.

func (*CommentQuery) Only

func (cq *CommentQuery) Only(ctx context.Context) (*Comment, error)

Only returns a single Comment entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one Comment entity is not found. Returns a *NotFoundError when no Comment entities are found.

func (*CommentQuery) OnlyID

func (cq *CommentQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only Comment ID in the query. Returns a *NotSingularError when exactly one Comment ID is not found. Returns a *NotFoundError when no entities are found.

func (*CommentQuery) OnlyIDX

func (cq *CommentQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*CommentQuery) OnlyX

func (cq *CommentQuery) OnlyX(ctx context.Context) *Comment

OnlyX is like Only, but panics if an error occurs.

func (*CommentQuery) Order

func (cq *CommentQuery) Order(o ...OrderFunc) *CommentQuery

Order adds an order step to the query.

func (*CommentQuery) QueryArticle

func (cq *CommentQuery) QueryArticle() *ArticleQuery

QueryArticle chains the current query on the "article" edge.

func (*CommentQuery) QueryAuthor

func (cq *CommentQuery) QueryAuthor() *KhumuUserQuery

QueryAuthor chains the current query on the "author" edge.

func (*CommentQuery) QueryChildren

func (cq *CommentQuery) QueryChildren() *CommentQuery

QueryChildren chains the current query on the "children" edge.

func (*CommentQuery) QueryLike

func (cq *CommentQuery) QueryLike() *LikeCommentQuery

QueryLike chains the current query on the "like" edge.

func (*CommentQuery) QueryParent

func (cq *CommentQuery) QueryParent() *CommentQuery

QueryParent chains the current query on the "parent" edge.

func (*CommentQuery) QueryStudyArticle

func (cq *CommentQuery) QueryStudyArticle() *StudyArticleQuery

QueryStudyArticle chains the current query on the "studyArticle" edge.

func (*CommentQuery) Select

func (cq *CommentQuery) Select(field string, fields ...string) *CommentSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	State string `json:"state,omitempty"`
}

client.Comment.Query().
	Select(comment.FieldState).
	Scan(ctx, &v)

func (*CommentQuery) Unique

func (cq *CommentQuery) Unique(unique bool) *CommentQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*CommentQuery) Where

func (cq *CommentQuery) Where(ps ...predicate.Comment) *CommentQuery

Where adds a new predicate for the CommentQuery builder.

func (*CommentQuery) WithArticle

func (cq *CommentQuery) WithArticle(opts ...func(*ArticleQuery)) *CommentQuery

WithArticle tells the query-builder to eager-load the nodes that are connected to the "article" edge. The optional arguments are used to configure the query builder of the edge.

func (*CommentQuery) WithAuthor

func (cq *CommentQuery) WithAuthor(opts ...func(*KhumuUserQuery)) *CommentQuery

WithAuthor tells the query-builder to eager-load the nodes that are connected to the "author" edge. The optional arguments are used to configure the query builder of the edge.

func (*CommentQuery) WithChildren

func (cq *CommentQuery) WithChildren(opts ...func(*CommentQuery)) *CommentQuery

WithChildren tells the query-builder to eager-load the nodes that are connected to the "children" edge. The optional arguments are used to configure the query builder of the edge.

func (*CommentQuery) WithLike

func (cq *CommentQuery) WithLike(opts ...func(*LikeCommentQuery)) *CommentQuery

WithLike tells the query-builder to eager-load the nodes that are connected to the "like" edge. The optional arguments are used to configure the query builder of the edge.

func (*CommentQuery) WithParent

func (cq *CommentQuery) WithParent(opts ...func(*CommentQuery)) *CommentQuery

WithParent tells the query-builder to eager-load the nodes that are connected to the "parent" edge. The optional arguments are used to configure the query builder of the edge.

func (*CommentQuery) WithStudyArticle

func (cq *CommentQuery) WithStudyArticle(opts ...func(*StudyArticleQuery)) *CommentQuery

WithStudyArticle tells the query-builder to eager-load the nodes that are connected to the "studyArticle" edge. The optional arguments are used to configure the query builder of the edge.

type CommentSelect

type CommentSelect struct {
	*CommentQuery
	// contains filtered or unexported fields
}

CommentSelect is the builder for selecting fields of Comment entities.

func (*CommentSelect) Bool

func (cs *CommentSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*CommentSelect) BoolX

func (cs *CommentSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*CommentSelect) Bools

func (cs *CommentSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*CommentSelect) BoolsX

func (cs *CommentSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*CommentSelect) Float64

func (cs *CommentSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*CommentSelect) Float64X

func (cs *CommentSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*CommentSelect) Float64s

func (cs *CommentSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*CommentSelect) Float64sX

func (cs *CommentSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*CommentSelect) Int

func (cs *CommentSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*CommentSelect) IntX

func (cs *CommentSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*CommentSelect) Ints

func (cs *CommentSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*CommentSelect) IntsX

func (cs *CommentSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*CommentSelect) Scan

func (cs *CommentSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*CommentSelect) ScanX

func (cs *CommentSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*CommentSelect) String

func (cs *CommentSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*CommentSelect) StringX

func (cs *CommentSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*CommentSelect) Strings

func (cs *CommentSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*CommentSelect) StringsX

func (cs *CommentSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type CommentUpdate

type CommentUpdate struct {
	// contains filtered or unexported fields
}

CommentUpdate is the builder for updating Comment entities.

func (*CommentUpdate) AddChildIDs

func (cu *CommentUpdate) AddChildIDs(ids ...int) *CommentUpdate

AddChildIDs adds the "children" edge to the Comment entity by IDs.

func (*CommentUpdate) AddChildren

func (cu *CommentUpdate) AddChildren(c ...*Comment) *CommentUpdate

AddChildren adds the "children" edges to the Comment entity.

func (*CommentUpdate) AddLike

func (cu *CommentUpdate) AddLike(l ...*LikeComment) *CommentUpdate

AddLike adds the "like" edges to the LikeComment entity.

func (*CommentUpdate) AddLikeIDs

func (cu *CommentUpdate) AddLikeIDs(ids ...int) *CommentUpdate

AddLikeIDs adds the "like" edge to the LikeComment entity by IDs.

func (*CommentUpdate) ClearArticle

func (cu *CommentUpdate) ClearArticle() *CommentUpdate

ClearArticle clears the "article" edge to the Article entity.

func (*CommentUpdate) ClearAuthor

func (cu *CommentUpdate) ClearAuthor() *CommentUpdate

ClearAuthor clears the "author" edge to the KhumuUser entity.

func (*CommentUpdate) ClearChildren

func (cu *CommentUpdate) ClearChildren() *CommentUpdate

ClearChildren clears all "children" edges to the Comment entity.

func (*CommentUpdate) ClearLike

func (cu *CommentUpdate) ClearLike() *CommentUpdate

ClearLike clears all "like" edges to the LikeComment entity.

func (*CommentUpdate) ClearParent

func (cu *CommentUpdate) ClearParent() *CommentUpdate

ClearParent clears the "parent" edge to the Comment entity.

func (*CommentUpdate) ClearStudyArticle

func (cu *CommentUpdate) ClearStudyArticle() *CommentUpdate

ClearStudyArticle clears the "studyArticle" edge to the StudyArticle entity.

func (*CommentUpdate) Exec

func (cu *CommentUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*CommentUpdate) ExecX

func (cu *CommentUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*CommentUpdate) Mutation

func (cu *CommentUpdate) Mutation() *CommentMutation

Mutation returns the CommentMutation object of the builder.

func (*CommentUpdate) RemoveChildIDs

func (cu *CommentUpdate) RemoveChildIDs(ids ...int) *CommentUpdate

RemoveChildIDs removes the "children" edge to Comment entities by IDs.

func (*CommentUpdate) RemoveChildren

func (cu *CommentUpdate) RemoveChildren(c ...*Comment) *CommentUpdate

RemoveChildren removes "children" edges to Comment entities.

func (*CommentUpdate) RemoveLike

func (cu *CommentUpdate) RemoveLike(l ...*LikeComment) *CommentUpdate

RemoveLike removes "like" edges to LikeComment entities.

func (*CommentUpdate) RemoveLikeIDs

func (cu *CommentUpdate) RemoveLikeIDs(ids ...int) *CommentUpdate

RemoveLikeIDs removes the "like" edge to LikeComment entities by IDs.

func (*CommentUpdate) Save

func (cu *CommentUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*CommentUpdate) SaveX

func (cu *CommentUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*CommentUpdate) SetArticle

func (cu *CommentUpdate) SetArticle(a *Article) *CommentUpdate

SetArticle sets the "article" edge to the Article entity.

func (*CommentUpdate) SetArticleID

func (cu *CommentUpdate) SetArticleID(id int) *CommentUpdate

SetArticleID sets the "article" edge to the Article entity by ID.

func (*CommentUpdate) SetAuthor

func (cu *CommentUpdate) SetAuthor(k *KhumuUser) *CommentUpdate

SetAuthor sets the "author" edge to the KhumuUser entity.

func (*CommentUpdate) SetAuthorID

func (cu *CommentUpdate) SetAuthorID(id string) *CommentUpdate

SetAuthorID sets the "author" edge to the KhumuUser entity by ID.

func (*CommentUpdate) SetContent

func (cu *CommentUpdate) SetContent(s string) *CommentUpdate

SetContent sets the "content" field.

func (*CommentUpdate) SetCreatedAt

func (cu *CommentUpdate) SetCreatedAt(t time.Time) *CommentUpdate

SetCreatedAt sets the "created_at" field.

func (*CommentUpdate) SetIsWrittenByArticleAuthor

func (cu *CommentUpdate) SetIsWrittenByArticleAuthor(b bool) *CommentUpdate

SetIsWrittenByArticleAuthor sets the "is_written_by_article_author" field.

func (*CommentUpdate) SetKind

func (cu *CommentUpdate) SetKind(s string) *CommentUpdate

SetKind sets the "kind" field.

func (*CommentUpdate) SetNillableArticleID

func (cu *CommentUpdate) SetNillableArticleID(id *int) *CommentUpdate

SetNillableArticleID sets the "article" edge to the Article entity by ID if the given value is not nil.

func (*CommentUpdate) SetNillableAuthorID

func (cu *CommentUpdate) SetNillableAuthorID(id *string) *CommentUpdate

SetNillableAuthorID sets the "author" edge to the KhumuUser entity by ID if the given value is not nil.

func (*CommentUpdate) SetNillableCreatedAt

func (cu *CommentUpdate) SetNillableCreatedAt(t *time.Time) *CommentUpdate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*CommentUpdate) SetNillableIsWrittenByArticleAuthor

func (cu *CommentUpdate) SetNillableIsWrittenByArticleAuthor(b *bool) *CommentUpdate

SetNillableIsWrittenByArticleAuthor sets the "is_written_by_article_author" field if the given value is not nil.

func (*CommentUpdate) SetNillableKind

func (cu *CommentUpdate) SetNillableKind(s *string) *CommentUpdate

SetNillableKind sets the "kind" field if the given value is not nil.

func (*CommentUpdate) SetNillableParentID

func (cu *CommentUpdate) SetNillableParentID(id *int) *CommentUpdate

SetNillableParentID sets the "parent" edge to the Comment entity by ID if the given value is not nil.

func (*CommentUpdate) SetNillableState

func (cu *CommentUpdate) SetNillableState(s *string) *CommentUpdate

SetNillableState sets the "state" field if the given value is not nil.

func (*CommentUpdate) SetNillableStudyArticleID

func (cu *CommentUpdate) SetNillableStudyArticleID(id *int) *CommentUpdate

SetNillableStudyArticleID sets the "studyArticle" edge to the StudyArticle entity by ID if the given value is not nil.

func (*CommentUpdate) SetParent

func (cu *CommentUpdate) SetParent(c *Comment) *CommentUpdate

SetParent sets the "parent" edge to the Comment entity.

func (*CommentUpdate) SetParentID

func (cu *CommentUpdate) SetParentID(id int) *CommentUpdate

SetParentID sets the "parent" edge to the Comment entity by ID.

func (*CommentUpdate) SetState

func (cu *CommentUpdate) SetState(s string) *CommentUpdate

SetState sets the "state" field.

func (*CommentUpdate) SetStudyArticle

func (cu *CommentUpdate) SetStudyArticle(s *StudyArticle) *CommentUpdate

SetStudyArticle sets the "studyArticle" edge to the StudyArticle entity.

func (*CommentUpdate) SetStudyArticleID

func (cu *CommentUpdate) SetStudyArticleID(id int) *CommentUpdate

SetStudyArticleID sets the "studyArticle" edge to the StudyArticle entity by ID.

func (*CommentUpdate) Where

func (cu *CommentUpdate) Where(ps ...predicate.Comment) *CommentUpdate

Where adds a new predicate for the CommentUpdate builder.

type CommentUpdateOne

type CommentUpdateOne struct {
	// contains filtered or unexported fields
}

CommentUpdateOne is the builder for updating a single Comment entity.

func (*CommentUpdateOne) AddChildIDs

func (cuo *CommentUpdateOne) AddChildIDs(ids ...int) *CommentUpdateOne

AddChildIDs adds the "children" edge to the Comment entity by IDs.

func (*CommentUpdateOne) AddChildren

func (cuo *CommentUpdateOne) AddChildren(c ...*Comment) *CommentUpdateOne

AddChildren adds the "children" edges to the Comment entity.

func (*CommentUpdateOne) AddLike

func (cuo *CommentUpdateOne) AddLike(l ...*LikeComment) *CommentUpdateOne

AddLike adds the "like" edges to the LikeComment entity.

func (*CommentUpdateOne) AddLikeIDs

func (cuo *CommentUpdateOne) AddLikeIDs(ids ...int) *CommentUpdateOne

AddLikeIDs adds the "like" edge to the LikeComment entity by IDs.

func (*CommentUpdateOne) ClearArticle

func (cuo *CommentUpdateOne) ClearArticle() *CommentUpdateOne

ClearArticle clears the "article" edge to the Article entity.

func (*CommentUpdateOne) ClearAuthor

func (cuo *CommentUpdateOne) ClearAuthor() *CommentUpdateOne

ClearAuthor clears the "author" edge to the KhumuUser entity.

func (*CommentUpdateOne) ClearChildren

func (cuo *CommentUpdateOne) ClearChildren() *CommentUpdateOne

ClearChildren clears all "children" edges to the Comment entity.

func (*CommentUpdateOne) ClearLike

func (cuo *CommentUpdateOne) ClearLike() *CommentUpdateOne

ClearLike clears all "like" edges to the LikeComment entity.

func (*CommentUpdateOne) ClearParent

func (cuo *CommentUpdateOne) ClearParent() *CommentUpdateOne

ClearParent clears the "parent" edge to the Comment entity.

func (*CommentUpdateOne) ClearStudyArticle

func (cuo *CommentUpdateOne) ClearStudyArticle() *CommentUpdateOne

ClearStudyArticle clears the "studyArticle" edge to the StudyArticle entity.

func (*CommentUpdateOne) Exec

func (cuo *CommentUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*CommentUpdateOne) ExecX

func (cuo *CommentUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*CommentUpdateOne) Mutation

func (cuo *CommentUpdateOne) Mutation() *CommentMutation

Mutation returns the CommentMutation object of the builder.

func (*CommentUpdateOne) RemoveChildIDs

func (cuo *CommentUpdateOne) RemoveChildIDs(ids ...int) *CommentUpdateOne

RemoveChildIDs removes the "children" edge to Comment entities by IDs.

func (*CommentUpdateOne) RemoveChildren

func (cuo *CommentUpdateOne) RemoveChildren(c ...*Comment) *CommentUpdateOne

RemoveChildren removes "children" edges to Comment entities.

func (*CommentUpdateOne) RemoveLike

func (cuo *CommentUpdateOne) RemoveLike(l ...*LikeComment) *CommentUpdateOne

RemoveLike removes "like" edges to LikeComment entities.

func (*CommentUpdateOne) RemoveLikeIDs

func (cuo *CommentUpdateOne) RemoveLikeIDs(ids ...int) *CommentUpdateOne

RemoveLikeIDs removes the "like" edge to LikeComment entities by IDs.

func (*CommentUpdateOne) Save

func (cuo *CommentUpdateOne) Save(ctx context.Context) (*Comment, error)

Save executes the query and returns the updated Comment entity.

func (*CommentUpdateOne) SaveX

func (cuo *CommentUpdateOne) SaveX(ctx context.Context) *Comment

SaveX is like Save, but panics if an error occurs.

func (*CommentUpdateOne) Select

func (cuo *CommentUpdateOne) Select(field string, fields ...string) *CommentUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*CommentUpdateOne) SetArticle

func (cuo *CommentUpdateOne) SetArticle(a *Article) *CommentUpdateOne

SetArticle sets the "article" edge to the Article entity.

func (*CommentUpdateOne) SetArticleID

func (cuo *CommentUpdateOne) SetArticleID(id int) *CommentUpdateOne

SetArticleID sets the "article" edge to the Article entity by ID.

func (*CommentUpdateOne) SetAuthor

func (cuo *CommentUpdateOne) SetAuthor(k *KhumuUser) *CommentUpdateOne

SetAuthor sets the "author" edge to the KhumuUser entity.

func (*CommentUpdateOne) SetAuthorID

func (cuo *CommentUpdateOne) SetAuthorID(id string) *CommentUpdateOne

SetAuthorID sets the "author" edge to the KhumuUser entity by ID.

func (*CommentUpdateOne) SetContent

func (cuo *CommentUpdateOne) SetContent(s string) *CommentUpdateOne

SetContent sets the "content" field.

func (*CommentUpdateOne) SetCreatedAt

func (cuo *CommentUpdateOne) SetCreatedAt(t time.Time) *CommentUpdateOne

SetCreatedAt sets the "created_at" field.

func (*CommentUpdateOne) SetIsWrittenByArticleAuthor

func (cuo *CommentUpdateOne) SetIsWrittenByArticleAuthor(b bool) *CommentUpdateOne

SetIsWrittenByArticleAuthor sets the "is_written_by_article_author" field.

func (*CommentUpdateOne) SetKind

func (cuo *CommentUpdateOne) SetKind(s string) *CommentUpdateOne

SetKind sets the "kind" field.

func (*CommentUpdateOne) SetNillableArticleID

func (cuo *CommentUpdateOne) SetNillableArticleID(id *int) *CommentUpdateOne

SetNillableArticleID sets the "article" edge to the Article entity by ID if the given value is not nil.

func (*CommentUpdateOne) SetNillableAuthorID

func (cuo *CommentUpdateOne) SetNillableAuthorID(id *string) *CommentUpdateOne

SetNillableAuthorID sets the "author" edge to the KhumuUser entity by ID if the given value is not nil.

func (*CommentUpdateOne) SetNillableCreatedAt

func (cuo *CommentUpdateOne) SetNillableCreatedAt(t *time.Time) *CommentUpdateOne

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*CommentUpdateOne) SetNillableIsWrittenByArticleAuthor

func (cuo *CommentUpdateOne) SetNillableIsWrittenByArticleAuthor(b *bool) *CommentUpdateOne

SetNillableIsWrittenByArticleAuthor sets the "is_written_by_article_author" field if the given value is not nil.

func (*CommentUpdateOne) SetNillableKind

func (cuo *CommentUpdateOne) SetNillableKind(s *string) *CommentUpdateOne

SetNillableKind sets the "kind" field if the given value is not nil.

func (*CommentUpdateOne) SetNillableParentID

func (cuo *CommentUpdateOne) SetNillableParentID(id *int) *CommentUpdateOne

SetNillableParentID sets the "parent" edge to the Comment entity by ID if the given value is not nil.

func (*CommentUpdateOne) SetNillableState

func (cuo *CommentUpdateOne) SetNillableState(s *string) *CommentUpdateOne

SetNillableState sets the "state" field if the given value is not nil.

func (*CommentUpdateOne) SetNillableStudyArticleID

func (cuo *CommentUpdateOne) SetNillableStudyArticleID(id *int) *CommentUpdateOne

SetNillableStudyArticleID sets the "studyArticle" edge to the StudyArticle entity by ID if the given value is not nil.

func (*CommentUpdateOne) SetParent

func (cuo *CommentUpdateOne) SetParent(c *Comment) *CommentUpdateOne

SetParent sets the "parent" edge to the Comment entity.

func (*CommentUpdateOne) SetParentID

func (cuo *CommentUpdateOne) SetParentID(id int) *CommentUpdateOne

SetParentID sets the "parent" edge to the Comment entity by ID.

func (*CommentUpdateOne) SetState

func (cuo *CommentUpdateOne) SetState(s string) *CommentUpdateOne

SetState sets the "state" field.

func (*CommentUpdateOne) SetStudyArticle

func (cuo *CommentUpdateOne) SetStudyArticle(s *StudyArticle) *CommentUpdateOne

SetStudyArticle sets the "studyArticle" edge to the StudyArticle entity.

func (*CommentUpdateOne) SetStudyArticleID

func (cuo *CommentUpdateOne) SetStudyArticleID(id int) *CommentUpdateOne

SetStudyArticleID sets the "studyArticle" edge to the StudyArticle entity by ID.

type Comments

type Comments []*Comment

Comments is a parsable slice of Comment.

type CommitFunc

type CommitFunc func(context.Context, *Tx) error

The CommitFunc type is an adapter to allow the use of ordinary function as a Committer. If f is a function with the appropriate signature, CommitFunc(f) is a Committer that calls f.

func (CommitFunc) Commit

func (f CommitFunc) Commit(ctx context.Context, tx *Tx) error

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

CommitHook defines the "commit middleware". A function that gets a Committer and returns a Committer. For example:

hook := func(next ent.Committer) ent.Committer {
	return ent.CommitFunc(func(context.Context, tx *ent.Tx) error {
		// Do some stuff before.
		if err := next.Commit(ctx, tx); err != nil {
			return err
		}
		// Do some stuff after.
		return nil
	})
}

type Committer

type Committer interface {
	Commit(context.Context, *Tx) error
}

Committer is the interface that wraps the Committer method.

type ConstraintError

type ConstraintError struct {
	// contains filtered or unexported fields
}

ConstraintError returns when trying to create/update one or more entities and one or more of their constraints failed. For example, violation of edge or field uniqueness.

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

ent aliases to avoid import conflicts in user's code.

type KhumuUser

type KhumuUser struct {

	// ID of the ent.
	ID string `json:"id,omitempty"`
	// Nickname holds the value of the "nickname" field.
	Nickname string `json:"nickname,omitempty"`
	// Password holds the value of the "password" field.
	Password string `json:"password,omitempty"`
	// StudentNumber holds the value of the "student_number" field.
	StudentNumber string `json:"student_number,omitempty"`
	// State holds the value of the "state" field.
	State string `json:"state,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the KhumuUserQuery when eager-loading is set.
	Edges KhumuUserEdges `json:"edges"`
	// contains filtered or unexported fields
}

KhumuUser is the model entity for the KhumuUser schema.

func (*KhumuUser) QueryArticles

func (ku *KhumuUser) QueryArticles() *ArticleQuery

QueryArticles queries the "articles" edge of the KhumuUser entity.

func (*KhumuUser) QueryComments

func (ku *KhumuUser) QueryComments() *CommentQuery

QueryComments queries the "comments" edge of the KhumuUser entity.

func (*KhumuUser) QueryLike

func (ku *KhumuUser) QueryLike() *LikeCommentQuery

QueryLike queries the "like" edge of the KhumuUser entity.

func (*KhumuUser) QueryStudyArticles

func (ku *KhumuUser) QueryStudyArticles() *StudyArticleQuery

QueryStudyArticles queries the "studyArticles" edge of the KhumuUser entity.

func (*KhumuUser) String

func (ku *KhumuUser) String() string

String implements the fmt.Stringer.

func (*KhumuUser) Unwrap

func (ku *KhumuUser) Unwrap() *KhumuUser

Unwrap unwraps the KhumuUser entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*KhumuUser) Update

func (ku *KhumuUser) Update() *KhumuUserUpdateOne

Update returns a builder for updating this KhumuUser. Note that you need to call KhumuUser.Unwrap() before calling this method if this KhumuUser was returned from a transaction, and the transaction was committed or rolled back.

type KhumuUserClient

type KhumuUserClient struct {
	// contains filtered or unexported fields
}

KhumuUserClient is a client for the KhumuUser schema.

func NewKhumuUserClient

func NewKhumuUserClient(c config) *KhumuUserClient

NewKhumuUserClient returns a client for the KhumuUser from the given config.

func (*KhumuUserClient) Create

func (c *KhumuUserClient) Create() *KhumuUserCreate

Create returns a create builder for KhumuUser.

func (*KhumuUserClient) CreateBulk

func (c *KhumuUserClient) CreateBulk(builders ...*KhumuUserCreate) *KhumuUserCreateBulk

CreateBulk returns a builder for creating a bulk of KhumuUser entities.

func (*KhumuUserClient) Delete

func (c *KhumuUserClient) Delete() *KhumuUserDelete

Delete returns a delete builder for KhumuUser.

func (*KhumuUserClient) DeleteOne

func (c *KhumuUserClient) DeleteOne(ku *KhumuUser) *KhumuUserDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*KhumuUserClient) DeleteOneID

func (c *KhumuUserClient) DeleteOneID(id string) *KhumuUserDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*KhumuUserClient) Get

func (c *KhumuUserClient) Get(ctx context.Context, id string) (*KhumuUser, error)

Get returns a KhumuUser entity by its id.

func (*KhumuUserClient) GetX

func (c *KhumuUserClient) GetX(ctx context.Context, id string) *KhumuUser

GetX is like Get, but panics if an error occurs.

func (*KhumuUserClient) Hooks

func (c *KhumuUserClient) Hooks() []Hook

Hooks returns the client hooks.

func (*KhumuUserClient) Query

func (c *KhumuUserClient) Query() *KhumuUserQuery

Query returns a query builder for KhumuUser.

func (*KhumuUserClient) QueryArticles

func (c *KhumuUserClient) QueryArticles(ku *KhumuUser) *ArticleQuery

QueryArticles queries the articles edge of a KhumuUser.

func (*KhumuUserClient) QueryComments

func (c *KhumuUserClient) QueryComments(ku *KhumuUser) *CommentQuery

QueryComments queries the comments edge of a KhumuUser.

func (*KhumuUserClient) QueryLike

func (c *KhumuUserClient) QueryLike(ku *KhumuUser) *LikeCommentQuery

QueryLike queries the like edge of a KhumuUser.

func (*KhumuUserClient) QueryStudyArticles

func (c *KhumuUserClient) QueryStudyArticles(ku *KhumuUser) *StudyArticleQuery

QueryStudyArticles queries the studyArticles edge of a KhumuUser.

func (*KhumuUserClient) Update

func (c *KhumuUserClient) Update() *KhumuUserUpdate

Update returns an update builder for KhumuUser.

func (*KhumuUserClient) UpdateOne

func (c *KhumuUserClient) UpdateOne(ku *KhumuUser) *KhumuUserUpdateOne

UpdateOne returns an update builder for the given entity.

func (*KhumuUserClient) UpdateOneID

func (c *KhumuUserClient) UpdateOneID(id string) *KhumuUserUpdateOne

UpdateOneID returns an update builder for the given id.

func (*KhumuUserClient) Use

func (c *KhumuUserClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `khumuuser.Hooks(f(g(h())))`.

type KhumuUserCreate

type KhumuUserCreate struct {
	// contains filtered or unexported fields
}

KhumuUserCreate is the builder for creating a KhumuUser entity.

func (*KhumuUserCreate) AddArticleIDs

func (kuc *KhumuUserCreate) AddArticleIDs(ids ...int) *KhumuUserCreate

AddArticleIDs adds the "articles" edge to the Article entity by IDs.

func (*KhumuUserCreate) AddArticles

func (kuc *KhumuUserCreate) AddArticles(a ...*Article) *KhumuUserCreate

AddArticles adds the "articles" edges to the Article entity.

func (*KhumuUserCreate) AddCommentIDs

func (kuc *KhumuUserCreate) AddCommentIDs(ids ...int) *KhumuUserCreate

AddCommentIDs adds the "comments" edge to the Comment entity by IDs.

func (*KhumuUserCreate) AddComments

func (kuc *KhumuUserCreate) AddComments(c ...*Comment) *KhumuUserCreate

AddComments adds the "comments" edges to the Comment entity.

func (*KhumuUserCreate) AddLike

func (kuc *KhumuUserCreate) AddLike(l ...*LikeComment) *KhumuUserCreate

AddLike adds the "like" edges to the LikeComment entity.

func (*KhumuUserCreate) AddLikeIDs

func (kuc *KhumuUserCreate) AddLikeIDs(ids ...int) *KhumuUserCreate

AddLikeIDs adds the "like" edge to the LikeComment entity by IDs.

func (*KhumuUserCreate) AddStudyArticleIDs

func (kuc *KhumuUserCreate) AddStudyArticleIDs(ids ...int) *KhumuUserCreate

AddStudyArticleIDs adds the "studyArticles" edge to the StudyArticle entity by IDs.

func (*KhumuUserCreate) AddStudyArticles

func (kuc *KhumuUserCreate) AddStudyArticles(s ...*StudyArticle) *KhumuUserCreate

AddStudyArticles adds the "studyArticles" edges to the StudyArticle entity.

func (*KhumuUserCreate) Mutation

func (kuc *KhumuUserCreate) Mutation() *KhumuUserMutation

Mutation returns the KhumuUserMutation object of the builder.

func (*KhumuUserCreate) Save

func (kuc *KhumuUserCreate) Save(ctx context.Context) (*KhumuUser, error)

Save creates the KhumuUser in the database.

func (*KhumuUserCreate) SaveX

func (kuc *KhumuUserCreate) SaveX(ctx context.Context) *KhumuUser

SaveX calls Save and panics if Save returns an error.

func (*KhumuUserCreate) SetID

func (kuc *KhumuUserCreate) SetID(s string) *KhumuUserCreate

SetID sets the "id" field.

func (*KhumuUserCreate) SetNickname

func (kuc *KhumuUserCreate) SetNickname(s string) *KhumuUserCreate

SetNickname sets the "nickname" field.

func (*KhumuUserCreate) SetNillableState

func (kuc *KhumuUserCreate) SetNillableState(s *string) *KhumuUserCreate

SetNillableState sets the "state" field if the given value is not nil.

func (*KhumuUserCreate) SetNillableStudentNumber

func (kuc *KhumuUserCreate) SetNillableStudentNumber(s *string) *KhumuUserCreate

SetNillableStudentNumber sets the "student_number" field if the given value is not nil.

func (*KhumuUserCreate) SetPassword

func (kuc *KhumuUserCreate) SetPassword(s string) *KhumuUserCreate

SetPassword sets the "password" field.

func (*KhumuUserCreate) SetState

func (kuc *KhumuUserCreate) SetState(s string) *KhumuUserCreate

SetState sets the "state" field.

func (*KhumuUserCreate) SetStudentNumber

func (kuc *KhumuUserCreate) SetStudentNumber(s string) *KhumuUserCreate

SetStudentNumber sets the "student_number" field.

type KhumuUserCreateBulk

type KhumuUserCreateBulk struct {
	// contains filtered or unexported fields
}

KhumuUserCreateBulk is the builder for creating many KhumuUser entities in bulk.

func (*KhumuUserCreateBulk) Save

func (kucb *KhumuUserCreateBulk) Save(ctx context.Context) ([]*KhumuUser, error)

Save creates the KhumuUser entities in the database.

func (*KhumuUserCreateBulk) SaveX

func (kucb *KhumuUserCreateBulk) SaveX(ctx context.Context) []*KhumuUser

SaveX is like Save, but panics if an error occurs.

type KhumuUserDelete

type KhumuUserDelete struct {
	// contains filtered or unexported fields
}

KhumuUserDelete is the builder for deleting a KhumuUser entity.

func (*KhumuUserDelete) Exec

func (kud *KhumuUserDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*KhumuUserDelete) ExecX

func (kud *KhumuUserDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*KhumuUserDelete) Where

Where adds a new predicate to the KhumuUserDelete builder.

type KhumuUserDeleteOne

type KhumuUserDeleteOne struct {
	// contains filtered or unexported fields
}

KhumuUserDeleteOne is the builder for deleting a single KhumuUser entity.

func (*KhumuUserDeleteOne) Exec

func (kudo *KhumuUserDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*KhumuUserDeleteOne) ExecX

func (kudo *KhumuUserDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type KhumuUserEdges

type KhumuUserEdges struct {
	// Comments holds the value of the comments edge.
	Comments []*Comment `json:"comments,omitempty"`
	// Articles holds the value of the articles edge.
	Articles []*Article `json:"articles,omitempty"`
	// StudyArticles holds the value of the studyArticles edge.
	StudyArticles []*StudyArticle `json:"studyArticles,omitempty"`
	// Like holds the value of the like edge.
	Like []*LikeComment `json:"like,omitempty"`
	// contains filtered or unexported fields
}

KhumuUserEdges holds the relations/edges for other nodes in the graph.

func (KhumuUserEdges) ArticlesOrErr

func (e KhumuUserEdges) ArticlesOrErr() ([]*Article, error)

ArticlesOrErr returns the Articles value or an error if the edge was not loaded in eager-loading.

func (KhumuUserEdges) CommentsOrErr

func (e KhumuUserEdges) CommentsOrErr() ([]*Comment, error)

CommentsOrErr returns the Comments value or an error if the edge was not loaded in eager-loading.

func (KhumuUserEdges) LikeOrErr

func (e KhumuUserEdges) LikeOrErr() ([]*LikeComment, error)

LikeOrErr returns the Like value or an error if the edge was not loaded in eager-loading.

func (KhumuUserEdges) StudyArticlesOrErr

func (e KhumuUserEdges) StudyArticlesOrErr() ([]*StudyArticle, error)

StudyArticlesOrErr returns the StudyArticles value or an error if the edge was not loaded in eager-loading.

type KhumuUserGroupBy

type KhumuUserGroupBy struct {
	// contains filtered or unexported fields
}

KhumuUserGroupBy is the group-by builder for KhumuUser entities.

func (*KhumuUserGroupBy) Aggregate

func (kugb *KhumuUserGroupBy) Aggregate(fns ...AggregateFunc) *KhumuUserGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*KhumuUserGroupBy) Bool

func (kugb *KhumuUserGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*KhumuUserGroupBy) BoolX

func (kugb *KhumuUserGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*KhumuUserGroupBy) Bools

func (kugb *KhumuUserGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*KhumuUserGroupBy) BoolsX

func (kugb *KhumuUserGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*KhumuUserGroupBy) Float64

func (kugb *KhumuUserGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*KhumuUserGroupBy) Float64X

func (kugb *KhumuUserGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*KhumuUserGroupBy) Float64s

func (kugb *KhumuUserGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*KhumuUserGroupBy) Float64sX

func (kugb *KhumuUserGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*KhumuUserGroupBy) Int

func (kugb *KhumuUserGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*KhumuUserGroupBy) IntX

func (kugb *KhumuUserGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*KhumuUserGroupBy) Ints

func (kugb *KhumuUserGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*KhumuUserGroupBy) IntsX

func (kugb *KhumuUserGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*KhumuUserGroupBy) Scan

func (kugb *KhumuUserGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*KhumuUserGroupBy) ScanX

func (kugb *KhumuUserGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*KhumuUserGroupBy) String

func (kugb *KhumuUserGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*KhumuUserGroupBy) StringX

func (kugb *KhumuUserGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*KhumuUserGroupBy) Strings

func (kugb *KhumuUserGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*KhumuUserGroupBy) StringsX

func (kugb *KhumuUserGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type KhumuUserMutation

type KhumuUserMutation struct {
	// contains filtered or unexported fields
}

KhumuUserMutation represents an operation that mutates the KhumuUser nodes in the graph.

func (*KhumuUserMutation) AddArticleIDs

func (m *KhumuUserMutation) AddArticleIDs(ids ...int)

AddArticleIDs adds the "articles" edge to the Article entity by ids.

func (*KhumuUserMutation) AddCommentIDs

func (m *KhumuUserMutation) AddCommentIDs(ids ...int)

AddCommentIDs adds the "comments" edge to the Comment entity by ids.

func (*KhumuUserMutation) AddField

func (m *KhumuUserMutation) 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 (*KhumuUserMutation) AddLikeIDs

func (m *KhumuUserMutation) AddLikeIDs(ids ...int)

AddLikeIDs adds the "like" edge to the LikeComment entity by ids.

func (*KhumuUserMutation) AddStudyArticleIDs

func (m *KhumuUserMutation) AddStudyArticleIDs(ids ...int)

AddStudyArticleIDs adds the "studyArticles" edge to the StudyArticle entity by ids.

func (*KhumuUserMutation) AddedEdges

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

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

func (*KhumuUserMutation) AddedField

func (m *KhumuUserMutation) 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 (*KhumuUserMutation) AddedFields

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

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

func (*KhumuUserMutation) AddedIDs

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

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*KhumuUserMutation) ArticlesCleared

func (m *KhumuUserMutation) ArticlesCleared() bool

ArticlesCleared reports if the "articles" edge to the Article entity was cleared.

func (*KhumuUserMutation) ArticlesIDs

func (m *KhumuUserMutation) ArticlesIDs() (ids []int)

ArticlesIDs returns the "articles" edge IDs in the mutation.

func (*KhumuUserMutation) ClearArticles

func (m *KhumuUserMutation) ClearArticles()

ClearArticles clears the "articles" edge to the Article entity.

func (*KhumuUserMutation) ClearComments

func (m *KhumuUserMutation) ClearComments()

ClearComments clears the "comments" edge to the Comment entity.

func (*KhumuUserMutation) ClearEdge

func (m *KhumuUserMutation) 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 (*KhumuUserMutation) ClearField

func (m *KhumuUserMutation) 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 (*KhumuUserMutation) ClearLike

func (m *KhumuUserMutation) ClearLike()

ClearLike clears the "like" edge to the LikeComment entity.

func (*KhumuUserMutation) ClearStudentNumber

func (m *KhumuUserMutation) ClearStudentNumber()

ClearStudentNumber clears the value of the "student_number" field.

func (*KhumuUserMutation) ClearStudyArticles

func (m *KhumuUserMutation) ClearStudyArticles()

ClearStudyArticles clears the "studyArticles" edge to the StudyArticle entity.

func (*KhumuUserMutation) ClearedEdges

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

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

func (*KhumuUserMutation) ClearedFields

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

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

func (KhumuUserMutation) Client

func (m KhumuUserMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*KhumuUserMutation) CommentsCleared

func (m *KhumuUserMutation) CommentsCleared() bool

CommentsCleared reports if the "comments" edge to the Comment entity was cleared.

func (*KhumuUserMutation) CommentsIDs

func (m *KhumuUserMutation) CommentsIDs() (ids []int)

CommentsIDs returns the "comments" edge IDs in the mutation.

func (*KhumuUserMutation) EdgeCleared

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

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*KhumuUserMutation) Field

func (m *KhumuUserMutation) 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 (*KhumuUserMutation) FieldCleared

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

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*KhumuUserMutation) Fields

func (m *KhumuUserMutation) 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 (*KhumuUserMutation) ID

func (m *KhumuUserMutation) ID() (id string, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder.

func (*KhumuUserMutation) LikeCleared

func (m *KhumuUserMutation) LikeCleared() bool

LikeCleared reports if the "like" edge to the LikeComment entity was cleared.

func (*KhumuUserMutation) LikeIDs

func (m *KhumuUserMutation) LikeIDs() (ids []int)

LikeIDs returns the "like" edge IDs in the mutation.

func (*KhumuUserMutation) Nickname

func (m *KhumuUserMutation) Nickname() (r string, exists bool)

Nickname returns the value of the "nickname" field in the mutation.

func (*KhumuUserMutation) OldField

func (m *KhumuUserMutation) 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 (*KhumuUserMutation) OldNickname

func (m *KhumuUserMutation) OldNickname(ctx context.Context) (v string, err error)

OldNickname returns the old "nickname" field's value of the KhumuUser entity. If the KhumuUser object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*KhumuUserMutation) OldPassword

func (m *KhumuUserMutation) OldPassword(ctx context.Context) (v string, err error)

OldPassword returns the old "password" field's value of the KhumuUser entity. If the KhumuUser object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*KhumuUserMutation) OldState

func (m *KhumuUserMutation) OldState(ctx context.Context) (v string, err error)

OldState returns the old "state" field's value of the KhumuUser entity. If the KhumuUser object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*KhumuUserMutation) OldStudentNumber

func (m *KhumuUserMutation) OldStudentNumber(ctx context.Context) (v string, err error)

OldStudentNumber returns the old "student_number" field's value of the KhumuUser entity. If the KhumuUser object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*KhumuUserMutation) Op

func (m *KhumuUserMutation) Op() Op

Op returns the operation name.

func (*KhumuUserMutation) Password

func (m *KhumuUserMutation) Password() (r string, exists bool)

Password returns the value of the "password" field in the mutation.

func (*KhumuUserMutation) RemoveArticleIDs

func (m *KhumuUserMutation) RemoveArticleIDs(ids ...int)

RemoveArticleIDs removes the "articles" edge to the Article entity by IDs.

func (*KhumuUserMutation) RemoveCommentIDs

func (m *KhumuUserMutation) RemoveCommentIDs(ids ...int)

RemoveCommentIDs removes the "comments" edge to the Comment entity by IDs.

func (*KhumuUserMutation) RemoveLikeIDs

func (m *KhumuUserMutation) RemoveLikeIDs(ids ...int)

RemoveLikeIDs removes the "like" edge to the LikeComment entity by IDs.

func (*KhumuUserMutation) RemoveStudyArticleIDs

func (m *KhumuUserMutation) RemoveStudyArticleIDs(ids ...int)

RemoveStudyArticleIDs removes the "studyArticles" edge to the StudyArticle entity by IDs.

func (*KhumuUserMutation) RemovedArticlesIDs

func (m *KhumuUserMutation) RemovedArticlesIDs() (ids []int)

RemovedArticles returns the removed IDs of the "articles" edge to the Article entity.

func (*KhumuUserMutation) RemovedCommentsIDs

func (m *KhumuUserMutation) RemovedCommentsIDs() (ids []int)

RemovedComments returns the removed IDs of the "comments" edge to the Comment entity.

func (*KhumuUserMutation) RemovedEdges

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

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

func (*KhumuUserMutation) RemovedIDs

func (m *KhumuUserMutation) 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 (*KhumuUserMutation) RemovedLikeIDs

func (m *KhumuUserMutation) RemovedLikeIDs() (ids []int)

RemovedLike returns the removed IDs of the "like" edge to the LikeComment entity.

func (*KhumuUserMutation) RemovedStudyArticlesIDs

func (m *KhumuUserMutation) RemovedStudyArticlesIDs() (ids []int)

RemovedStudyArticles returns the removed IDs of the "studyArticles" edge to the StudyArticle entity.

func (*KhumuUserMutation) ResetArticles

func (m *KhumuUserMutation) ResetArticles()

ResetArticles resets all changes to the "articles" edge.

func (*KhumuUserMutation) ResetComments

func (m *KhumuUserMutation) ResetComments()

ResetComments resets all changes to the "comments" edge.

func (*KhumuUserMutation) ResetEdge

func (m *KhumuUserMutation) 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 (*KhumuUserMutation) ResetField

func (m *KhumuUserMutation) 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 (*KhumuUserMutation) ResetLike

func (m *KhumuUserMutation) ResetLike()

ResetLike resets all changes to the "like" edge.

func (*KhumuUserMutation) ResetNickname

func (m *KhumuUserMutation) ResetNickname()

ResetNickname resets all changes to the "nickname" field.

func (*KhumuUserMutation) ResetPassword

func (m *KhumuUserMutation) ResetPassword()

ResetPassword resets all changes to the "password" field.

func (*KhumuUserMutation) ResetState

func (m *KhumuUserMutation) ResetState()

ResetState resets all changes to the "state" field.

func (*KhumuUserMutation) ResetStudentNumber

func (m *KhumuUserMutation) ResetStudentNumber()

ResetStudentNumber resets all changes to the "student_number" field.

func (*KhumuUserMutation) ResetStudyArticles

func (m *KhumuUserMutation) ResetStudyArticles()

ResetStudyArticles resets all changes to the "studyArticles" edge.

func (*KhumuUserMutation) SetField

func (m *KhumuUserMutation) 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 (*KhumuUserMutation) SetID

func (m *KhumuUserMutation) SetID(id string)

SetID sets the value of the id field. Note that this operation is only accepted on creation of KhumuUser entities.

func (*KhumuUserMutation) SetNickname

func (m *KhumuUserMutation) SetNickname(s string)

SetNickname sets the "nickname" field.

func (*KhumuUserMutation) SetPassword

func (m *KhumuUserMutation) SetPassword(s string)

SetPassword sets the "password" field.

func (*KhumuUserMutation) SetState

func (m *KhumuUserMutation) SetState(s string)

SetState sets the "state" field.

func (*KhumuUserMutation) SetStudentNumber

func (m *KhumuUserMutation) SetStudentNumber(s string)

SetStudentNumber sets the "student_number" field.

func (*KhumuUserMutation) State

func (m *KhumuUserMutation) State() (r string, exists bool)

State returns the value of the "state" field in the mutation.

func (*KhumuUserMutation) StudentNumber

func (m *KhumuUserMutation) StudentNumber() (r string, exists bool)

StudentNumber returns the value of the "student_number" field in the mutation.

func (*KhumuUserMutation) StudentNumberCleared

func (m *KhumuUserMutation) StudentNumberCleared() bool

StudentNumberCleared returns if the "student_number" field was cleared in this mutation.

func (*KhumuUserMutation) StudyArticlesCleared

func (m *KhumuUserMutation) StudyArticlesCleared() bool

StudyArticlesCleared reports if the "studyArticles" edge to the StudyArticle entity was cleared.

func (*KhumuUserMutation) StudyArticlesIDs

func (m *KhumuUserMutation) StudyArticlesIDs() (ids []int)

StudyArticlesIDs returns the "studyArticles" edge IDs in the mutation.

func (KhumuUserMutation) Tx

func (m KhumuUserMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*KhumuUserMutation) Type

func (m *KhumuUserMutation) Type() string

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

type KhumuUserQuery

type KhumuUserQuery struct {
	// contains filtered or unexported fields
}

KhumuUserQuery is the builder for querying KhumuUser entities.

func (*KhumuUserQuery) All

func (kuq *KhumuUserQuery) All(ctx context.Context) ([]*KhumuUser, error)

All executes the query and returns a list of KhumuUsers.

func (*KhumuUserQuery) AllX

func (kuq *KhumuUserQuery) AllX(ctx context.Context) []*KhumuUser

AllX is like All, but panics if an error occurs.

func (*KhumuUserQuery) Clone

func (kuq *KhumuUserQuery) Clone() *KhumuUserQuery

Clone returns a duplicate of the KhumuUserQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*KhumuUserQuery) Count

func (kuq *KhumuUserQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*KhumuUserQuery) CountX

func (kuq *KhumuUserQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*KhumuUserQuery) Exist

func (kuq *KhumuUserQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*KhumuUserQuery) ExistX

func (kuq *KhumuUserQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*KhumuUserQuery) First

func (kuq *KhumuUserQuery) First(ctx context.Context) (*KhumuUser, error)

First returns the first KhumuUser entity from the query. Returns a *NotFoundError when no KhumuUser was found.

func (*KhumuUserQuery) FirstID

func (kuq *KhumuUserQuery) FirstID(ctx context.Context) (id string, err error)

FirstID returns the first KhumuUser ID from the query. Returns a *NotFoundError when no KhumuUser ID was found.

func (*KhumuUserQuery) FirstIDX

func (kuq *KhumuUserQuery) FirstIDX(ctx context.Context) string

FirstIDX is like FirstID, but panics if an error occurs.

func (*KhumuUserQuery) FirstX

func (kuq *KhumuUserQuery) FirstX(ctx context.Context) *KhumuUser

FirstX is like First, but panics if an error occurs.

func (*KhumuUserQuery) GroupBy

func (kuq *KhumuUserQuery) GroupBy(field string, fields ...string) *KhumuUserGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	Nickname string `json:"nickname,omitempty"`
	Count int `json:"count,omitempty"`
}

client.KhumuUser.Query().
	GroupBy(khumuuser.FieldNickname).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*KhumuUserQuery) IDs

func (kuq *KhumuUserQuery) IDs(ctx context.Context) ([]string, error)

IDs executes the query and returns a list of KhumuUser IDs.

func (*KhumuUserQuery) IDsX

func (kuq *KhumuUserQuery) IDsX(ctx context.Context) []string

IDsX is like IDs, but panics if an error occurs.

func (*KhumuUserQuery) Limit

func (kuq *KhumuUserQuery) Limit(limit int) *KhumuUserQuery

Limit adds a limit step to the query.

func (*KhumuUserQuery) Offset

func (kuq *KhumuUserQuery) Offset(offset int) *KhumuUserQuery

Offset adds an offset step to the query.

func (*KhumuUserQuery) Only

func (kuq *KhumuUserQuery) Only(ctx context.Context) (*KhumuUser, error)

Only returns a single KhumuUser entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one KhumuUser entity is not found. Returns a *NotFoundError when no KhumuUser entities are found.

func (*KhumuUserQuery) OnlyID

func (kuq *KhumuUserQuery) OnlyID(ctx context.Context) (id string, err error)

OnlyID is like Only, but returns the only KhumuUser ID in the query. Returns a *NotSingularError when exactly one KhumuUser ID is not found. Returns a *NotFoundError when no entities are found.

func (*KhumuUserQuery) OnlyIDX

func (kuq *KhumuUserQuery) OnlyIDX(ctx context.Context) string

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*KhumuUserQuery) OnlyX

func (kuq *KhumuUserQuery) OnlyX(ctx context.Context) *KhumuUser

OnlyX is like Only, but panics if an error occurs.

func (*KhumuUserQuery) Order

func (kuq *KhumuUserQuery) Order(o ...OrderFunc) *KhumuUserQuery

Order adds an order step to the query.

func (*KhumuUserQuery) QueryArticles

func (kuq *KhumuUserQuery) QueryArticles() *ArticleQuery

QueryArticles chains the current query on the "articles" edge.

func (*KhumuUserQuery) QueryComments

func (kuq *KhumuUserQuery) QueryComments() *CommentQuery

QueryComments chains the current query on the "comments" edge.

func (*KhumuUserQuery) QueryLike

func (kuq *KhumuUserQuery) QueryLike() *LikeCommentQuery

QueryLike chains the current query on the "like" edge.

func (*KhumuUserQuery) QueryStudyArticles

func (kuq *KhumuUserQuery) QueryStudyArticles() *StudyArticleQuery

QueryStudyArticles chains the current query on the "studyArticles" edge.

func (*KhumuUserQuery) Select

func (kuq *KhumuUserQuery) Select(field string, fields ...string) *KhumuUserSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	Nickname string `json:"nickname,omitempty"`
}

client.KhumuUser.Query().
	Select(khumuuser.FieldNickname).
	Scan(ctx, &v)

func (*KhumuUserQuery) Unique

func (kuq *KhumuUserQuery) Unique(unique bool) *KhumuUserQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*KhumuUserQuery) Where

func (kuq *KhumuUserQuery) Where(ps ...predicate.KhumuUser) *KhumuUserQuery

Where adds a new predicate for the KhumuUserQuery builder.

func (*KhumuUserQuery) WithArticles

func (kuq *KhumuUserQuery) WithArticles(opts ...func(*ArticleQuery)) *KhumuUserQuery

WithArticles tells the query-builder to eager-load the nodes that are connected to the "articles" edge. The optional arguments are used to configure the query builder of the edge.

func (*KhumuUserQuery) WithComments

func (kuq *KhumuUserQuery) WithComments(opts ...func(*CommentQuery)) *KhumuUserQuery

WithComments tells the query-builder to eager-load the nodes that are connected to the "comments" edge. The optional arguments are used to configure the query builder of the edge.

func (*KhumuUserQuery) WithLike

func (kuq *KhumuUserQuery) WithLike(opts ...func(*LikeCommentQuery)) *KhumuUserQuery

WithLike tells the query-builder to eager-load the nodes that are connected to the "like" edge. The optional arguments are used to configure the query builder of the edge.

func (*KhumuUserQuery) WithStudyArticles

func (kuq *KhumuUserQuery) WithStudyArticles(opts ...func(*StudyArticleQuery)) *KhumuUserQuery

WithStudyArticles tells the query-builder to eager-load the nodes that are connected to the "studyArticles" edge. The optional arguments are used to configure the query builder of the edge.

type KhumuUserSelect

type KhumuUserSelect struct {
	*KhumuUserQuery
	// contains filtered or unexported fields
}

KhumuUserSelect is the builder for selecting fields of KhumuUser entities.

func (*KhumuUserSelect) Bool

func (kus *KhumuUserSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*KhumuUserSelect) BoolX

func (kus *KhumuUserSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*KhumuUserSelect) Bools

func (kus *KhumuUserSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*KhumuUserSelect) BoolsX

func (kus *KhumuUserSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*KhumuUserSelect) Float64

func (kus *KhumuUserSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*KhumuUserSelect) Float64X

func (kus *KhumuUserSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*KhumuUserSelect) Float64s

func (kus *KhumuUserSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*KhumuUserSelect) Float64sX

func (kus *KhumuUserSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*KhumuUserSelect) Int

func (kus *KhumuUserSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*KhumuUserSelect) IntX

func (kus *KhumuUserSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*KhumuUserSelect) Ints

func (kus *KhumuUserSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*KhumuUserSelect) IntsX

func (kus *KhumuUserSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*KhumuUserSelect) Scan

func (kus *KhumuUserSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*KhumuUserSelect) ScanX

func (kus *KhumuUserSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*KhumuUserSelect) String

func (kus *KhumuUserSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*KhumuUserSelect) StringX

func (kus *KhumuUserSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*KhumuUserSelect) Strings

func (kus *KhumuUserSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*KhumuUserSelect) StringsX

func (kus *KhumuUserSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type KhumuUserUpdate

type KhumuUserUpdate struct {
	// contains filtered or unexported fields
}

KhumuUserUpdate is the builder for updating KhumuUser entities.

func (*KhumuUserUpdate) AddArticleIDs

func (kuu *KhumuUserUpdate) AddArticleIDs(ids ...int) *KhumuUserUpdate

AddArticleIDs adds the "articles" edge to the Article entity by IDs.

func (*KhumuUserUpdate) AddArticles

func (kuu *KhumuUserUpdate) AddArticles(a ...*Article) *KhumuUserUpdate

AddArticles adds the "articles" edges to the Article entity.

func (*KhumuUserUpdate) AddCommentIDs

func (kuu *KhumuUserUpdate) AddCommentIDs(ids ...int) *KhumuUserUpdate

AddCommentIDs adds the "comments" edge to the Comment entity by IDs.

func (*KhumuUserUpdate) AddComments

func (kuu *KhumuUserUpdate) AddComments(c ...*Comment) *KhumuUserUpdate

AddComments adds the "comments" edges to the Comment entity.

func (*KhumuUserUpdate) AddLike

func (kuu *KhumuUserUpdate) AddLike(l ...*LikeComment) *KhumuUserUpdate

AddLike adds the "like" edges to the LikeComment entity.

func (*KhumuUserUpdate) AddLikeIDs

func (kuu *KhumuUserUpdate) AddLikeIDs(ids ...int) *KhumuUserUpdate

AddLikeIDs adds the "like" edge to the LikeComment entity by IDs.

func (*KhumuUserUpdate) AddStudyArticleIDs

func (kuu *KhumuUserUpdate) AddStudyArticleIDs(ids ...int) *KhumuUserUpdate

AddStudyArticleIDs adds the "studyArticles" edge to the StudyArticle entity by IDs.

func (*KhumuUserUpdate) AddStudyArticles

func (kuu *KhumuUserUpdate) AddStudyArticles(s ...*StudyArticle) *KhumuUserUpdate

AddStudyArticles adds the "studyArticles" edges to the StudyArticle entity.

func (*KhumuUserUpdate) ClearArticles

func (kuu *KhumuUserUpdate) ClearArticles() *KhumuUserUpdate

ClearArticles clears all "articles" edges to the Article entity.

func (*KhumuUserUpdate) ClearComments

func (kuu *KhumuUserUpdate) ClearComments() *KhumuUserUpdate

ClearComments clears all "comments" edges to the Comment entity.

func (*KhumuUserUpdate) ClearLike

func (kuu *KhumuUserUpdate) ClearLike() *KhumuUserUpdate

ClearLike clears all "like" edges to the LikeComment entity.

func (*KhumuUserUpdate) ClearStudentNumber

func (kuu *KhumuUserUpdate) ClearStudentNumber() *KhumuUserUpdate

ClearStudentNumber clears the value of the "student_number" field.

func (*KhumuUserUpdate) ClearStudyArticles

func (kuu *KhumuUserUpdate) ClearStudyArticles() *KhumuUserUpdate

ClearStudyArticles clears all "studyArticles" edges to the StudyArticle entity.

func (*KhumuUserUpdate) Exec

func (kuu *KhumuUserUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*KhumuUserUpdate) ExecX

func (kuu *KhumuUserUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*KhumuUserUpdate) Mutation

func (kuu *KhumuUserUpdate) Mutation() *KhumuUserMutation

Mutation returns the KhumuUserMutation object of the builder.

func (*KhumuUserUpdate) RemoveArticleIDs

func (kuu *KhumuUserUpdate) RemoveArticleIDs(ids ...int) *KhumuUserUpdate

RemoveArticleIDs removes the "articles" edge to Article entities by IDs.

func (*KhumuUserUpdate) RemoveArticles

func (kuu *KhumuUserUpdate) RemoveArticles(a ...*Article) *KhumuUserUpdate

RemoveArticles removes "articles" edges to Article entities.

func (*KhumuUserUpdate) RemoveCommentIDs

func (kuu *KhumuUserUpdate) RemoveCommentIDs(ids ...int) *KhumuUserUpdate

RemoveCommentIDs removes the "comments" edge to Comment entities by IDs.

func (*KhumuUserUpdate) RemoveComments

func (kuu *KhumuUserUpdate) RemoveComments(c ...*Comment) *KhumuUserUpdate

RemoveComments removes "comments" edges to Comment entities.

func (*KhumuUserUpdate) RemoveLike

func (kuu *KhumuUserUpdate) RemoveLike(l ...*LikeComment) *KhumuUserUpdate

RemoveLike removes "like" edges to LikeComment entities.

func (*KhumuUserUpdate) RemoveLikeIDs

func (kuu *KhumuUserUpdate) RemoveLikeIDs(ids ...int) *KhumuUserUpdate

RemoveLikeIDs removes the "like" edge to LikeComment entities by IDs.

func (*KhumuUserUpdate) RemoveStudyArticleIDs

func (kuu *KhumuUserUpdate) RemoveStudyArticleIDs(ids ...int) *KhumuUserUpdate

RemoveStudyArticleIDs removes the "studyArticles" edge to StudyArticle entities by IDs.

func (*KhumuUserUpdate) RemoveStudyArticles

func (kuu *KhumuUserUpdate) RemoveStudyArticles(s ...*StudyArticle) *KhumuUserUpdate

RemoveStudyArticles removes "studyArticles" edges to StudyArticle entities.

func (*KhumuUserUpdate) Save

func (kuu *KhumuUserUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*KhumuUserUpdate) SaveX

func (kuu *KhumuUserUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*KhumuUserUpdate) SetNickname

func (kuu *KhumuUserUpdate) SetNickname(s string) *KhumuUserUpdate

SetNickname sets the "nickname" field.

func (*KhumuUserUpdate) SetNillableState

func (kuu *KhumuUserUpdate) SetNillableState(s *string) *KhumuUserUpdate

SetNillableState sets the "state" field if the given value is not nil.

func (*KhumuUserUpdate) SetNillableStudentNumber

func (kuu *KhumuUserUpdate) SetNillableStudentNumber(s *string) *KhumuUserUpdate

SetNillableStudentNumber sets the "student_number" field if the given value is not nil.

func (*KhumuUserUpdate) SetPassword

func (kuu *KhumuUserUpdate) SetPassword(s string) *KhumuUserUpdate

SetPassword sets the "password" field.

func (*KhumuUserUpdate) SetState

func (kuu *KhumuUserUpdate) SetState(s string) *KhumuUserUpdate

SetState sets the "state" field.

func (*KhumuUserUpdate) SetStudentNumber

func (kuu *KhumuUserUpdate) SetStudentNumber(s string) *KhumuUserUpdate

SetStudentNumber sets the "student_number" field.

func (*KhumuUserUpdate) Where

Where adds a new predicate for the KhumuUserUpdate builder.

type KhumuUserUpdateOne

type KhumuUserUpdateOne struct {
	// contains filtered or unexported fields
}

KhumuUserUpdateOne is the builder for updating a single KhumuUser entity.

func (*KhumuUserUpdateOne) AddArticleIDs

func (kuuo *KhumuUserUpdateOne) AddArticleIDs(ids ...int) *KhumuUserUpdateOne

AddArticleIDs adds the "articles" edge to the Article entity by IDs.

func (*KhumuUserUpdateOne) AddArticles

func (kuuo *KhumuUserUpdateOne) AddArticles(a ...*Article) *KhumuUserUpdateOne

AddArticles adds the "articles" edges to the Article entity.

func (*KhumuUserUpdateOne) AddCommentIDs

func (kuuo *KhumuUserUpdateOne) AddCommentIDs(ids ...int) *KhumuUserUpdateOne

AddCommentIDs adds the "comments" edge to the Comment entity by IDs.

func (*KhumuUserUpdateOne) AddComments

func (kuuo *KhumuUserUpdateOne) AddComments(c ...*Comment) *KhumuUserUpdateOne

AddComments adds the "comments" edges to the Comment entity.

func (*KhumuUserUpdateOne) AddLike

func (kuuo *KhumuUserUpdateOne) AddLike(l ...*LikeComment) *KhumuUserUpdateOne

AddLike adds the "like" edges to the LikeComment entity.

func (*KhumuUserUpdateOne) AddLikeIDs

func (kuuo *KhumuUserUpdateOne) AddLikeIDs(ids ...int) *KhumuUserUpdateOne

AddLikeIDs adds the "like" edge to the LikeComment entity by IDs.

func (*KhumuUserUpdateOne) AddStudyArticleIDs

func (kuuo *KhumuUserUpdateOne) AddStudyArticleIDs(ids ...int) *KhumuUserUpdateOne

AddStudyArticleIDs adds the "studyArticles" edge to the StudyArticle entity by IDs.

func (*KhumuUserUpdateOne) AddStudyArticles

func (kuuo *KhumuUserUpdateOne) AddStudyArticles(s ...*StudyArticle) *KhumuUserUpdateOne

AddStudyArticles adds the "studyArticles" edges to the StudyArticle entity.

func (*KhumuUserUpdateOne) ClearArticles

func (kuuo *KhumuUserUpdateOne) ClearArticles() *KhumuUserUpdateOne

ClearArticles clears all "articles" edges to the Article entity.

func (*KhumuUserUpdateOne) ClearComments

func (kuuo *KhumuUserUpdateOne) ClearComments() *KhumuUserUpdateOne

ClearComments clears all "comments" edges to the Comment entity.

func (*KhumuUserUpdateOne) ClearLike

func (kuuo *KhumuUserUpdateOne) ClearLike() *KhumuUserUpdateOne

ClearLike clears all "like" edges to the LikeComment entity.

func (*KhumuUserUpdateOne) ClearStudentNumber

func (kuuo *KhumuUserUpdateOne) ClearStudentNumber() *KhumuUserUpdateOne

ClearStudentNumber clears the value of the "student_number" field.

func (*KhumuUserUpdateOne) ClearStudyArticles

func (kuuo *KhumuUserUpdateOne) ClearStudyArticles() *KhumuUserUpdateOne

ClearStudyArticles clears all "studyArticles" edges to the StudyArticle entity.

func (*KhumuUserUpdateOne) Exec

func (kuuo *KhumuUserUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*KhumuUserUpdateOne) ExecX

func (kuuo *KhumuUserUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*KhumuUserUpdateOne) Mutation

func (kuuo *KhumuUserUpdateOne) Mutation() *KhumuUserMutation

Mutation returns the KhumuUserMutation object of the builder.

func (*KhumuUserUpdateOne) RemoveArticleIDs

func (kuuo *KhumuUserUpdateOne) RemoveArticleIDs(ids ...int) *KhumuUserUpdateOne

RemoveArticleIDs removes the "articles" edge to Article entities by IDs.

func (*KhumuUserUpdateOne) RemoveArticles

func (kuuo *KhumuUserUpdateOne) RemoveArticles(a ...*Article) *KhumuUserUpdateOne

RemoveArticles removes "articles" edges to Article entities.

func (*KhumuUserUpdateOne) RemoveCommentIDs

func (kuuo *KhumuUserUpdateOne) RemoveCommentIDs(ids ...int) *KhumuUserUpdateOne

RemoveCommentIDs removes the "comments" edge to Comment entities by IDs.

func (*KhumuUserUpdateOne) RemoveComments

func (kuuo *KhumuUserUpdateOne) RemoveComments(c ...*Comment) *KhumuUserUpdateOne

RemoveComments removes "comments" edges to Comment entities.

func (*KhumuUserUpdateOne) RemoveLike

func (kuuo *KhumuUserUpdateOne) RemoveLike(l ...*LikeComment) *KhumuUserUpdateOne

RemoveLike removes "like" edges to LikeComment entities.

func (*KhumuUserUpdateOne) RemoveLikeIDs

func (kuuo *KhumuUserUpdateOne) RemoveLikeIDs(ids ...int) *KhumuUserUpdateOne

RemoveLikeIDs removes the "like" edge to LikeComment entities by IDs.

func (*KhumuUserUpdateOne) RemoveStudyArticleIDs

func (kuuo *KhumuUserUpdateOne) RemoveStudyArticleIDs(ids ...int) *KhumuUserUpdateOne

RemoveStudyArticleIDs removes the "studyArticles" edge to StudyArticle entities by IDs.

func (*KhumuUserUpdateOne) RemoveStudyArticles

func (kuuo *KhumuUserUpdateOne) RemoveStudyArticles(s ...*StudyArticle) *KhumuUserUpdateOne

RemoveStudyArticles removes "studyArticles" edges to StudyArticle entities.

func (*KhumuUserUpdateOne) Save

func (kuuo *KhumuUserUpdateOne) Save(ctx context.Context) (*KhumuUser, error)

Save executes the query and returns the updated KhumuUser entity.

func (*KhumuUserUpdateOne) SaveX

func (kuuo *KhumuUserUpdateOne) SaveX(ctx context.Context) *KhumuUser

SaveX is like Save, but panics if an error occurs.

func (*KhumuUserUpdateOne) Select

func (kuuo *KhumuUserUpdateOne) Select(field string, fields ...string) *KhumuUserUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*KhumuUserUpdateOne) SetNickname

func (kuuo *KhumuUserUpdateOne) SetNickname(s string) *KhumuUserUpdateOne

SetNickname sets the "nickname" field.

func (*KhumuUserUpdateOne) SetNillableState

func (kuuo *KhumuUserUpdateOne) SetNillableState(s *string) *KhumuUserUpdateOne

SetNillableState sets the "state" field if the given value is not nil.

func (*KhumuUserUpdateOne) SetNillableStudentNumber

func (kuuo *KhumuUserUpdateOne) SetNillableStudentNumber(s *string) *KhumuUserUpdateOne

SetNillableStudentNumber sets the "student_number" field if the given value is not nil.

func (*KhumuUserUpdateOne) SetPassword

func (kuuo *KhumuUserUpdateOne) SetPassword(s string) *KhumuUserUpdateOne

SetPassword sets the "password" field.

func (*KhumuUserUpdateOne) SetState

func (kuuo *KhumuUserUpdateOne) SetState(s string) *KhumuUserUpdateOne

SetState sets the "state" field.

func (*KhumuUserUpdateOne) SetStudentNumber

func (kuuo *KhumuUserUpdateOne) SetStudentNumber(s string) *KhumuUserUpdateOne

SetStudentNumber sets the "student_number" field.

type KhumuUsers

type KhumuUsers []*KhumuUser

KhumuUsers is a parsable slice of KhumuUser.

type LikeComment

type LikeComment struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the LikeCommentQuery when eager-loading is set.
	Edges LikeCommentEdges `json:"edges"`
	// contains filtered or unexported fields
}

LikeComment is the model entity for the LikeComment schema.

func (*LikeComment) QueryAbout

func (lc *LikeComment) QueryAbout() *CommentQuery

QueryAbout queries the "about" edge of the LikeComment entity.

func (*LikeComment) QueryLikedBy

func (lc *LikeComment) QueryLikedBy() *KhumuUserQuery

QueryLikedBy queries the "likedBy" edge of the LikeComment entity.

func (*LikeComment) String

func (lc *LikeComment) String() string

String implements the fmt.Stringer.

func (*LikeComment) Unwrap

func (lc *LikeComment) Unwrap() *LikeComment

Unwrap unwraps the LikeComment entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*LikeComment) Update

func (lc *LikeComment) Update() *LikeCommentUpdateOne

Update returns a builder for updating this LikeComment. Note that you need to call LikeComment.Unwrap() before calling this method if this LikeComment was returned from a transaction, and the transaction was committed or rolled back.

type LikeCommentClient

type LikeCommentClient struct {
	// contains filtered or unexported fields
}

LikeCommentClient is a client for the LikeComment schema.

func NewLikeCommentClient

func NewLikeCommentClient(c config) *LikeCommentClient

NewLikeCommentClient returns a client for the LikeComment from the given config.

func (*LikeCommentClient) Create

func (c *LikeCommentClient) Create() *LikeCommentCreate

Create returns a create builder for LikeComment.

func (*LikeCommentClient) CreateBulk

func (c *LikeCommentClient) CreateBulk(builders ...*LikeCommentCreate) *LikeCommentCreateBulk

CreateBulk returns a builder for creating a bulk of LikeComment entities.

func (*LikeCommentClient) Delete

func (c *LikeCommentClient) Delete() *LikeCommentDelete

Delete returns a delete builder for LikeComment.

func (*LikeCommentClient) DeleteOne

DeleteOne returns a delete builder for the given entity.

func (*LikeCommentClient) DeleteOneID

func (c *LikeCommentClient) DeleteOneID(id int) *LikeCommentDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*LikeCommentClient) Get

func (c *LikeCommentClient) Get(ctx context.Context, id int) (*LikeComment, error)

Get returns a LikeComment entity by its id.

func (*LikeCommentClient) GetX

func (c *LikeCommentClient) GetX(ctx context.Context, id int) *LikeComment

GetX is like Get, but panics if an error occurs.

func (*LikeCommentClient) Hooks

func (c *LikeCommentClient) Hooks() []Hook

Hooks returns the client hooks.

func (*LikeCommentClient) Query

func (c *LikeCommentClient) Query() *LikeCommentQuery

Query returns a query builder for LikeComment.

func (*LikeCommentClient) QueryAbout

func (c *LikeCommentClient) QueryAbout(lc *LikeComment) *CommentQuery

QueryAbout queries the about edge of a LikeComment.

func (*LikeCommentClient) QueryLikedBy

func (c *LikeCommentClient) QueryLikedBy(lc *LikeComment) *KhumuUserQuery

QueryLikedBy queries the likedBy edge of a LikeComment.

func (*LikeCommentClient) Update

func (c *LikeCommentClient) Update() *LikeCommentUpdate

Update returns an update builder for LikeComment.

func (*LikeCommentClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*LikeCommentClient) UpdateOneID

func (c *LikeCommentClient) UpdateOneID(id int) *LikeCommentUpdateOne

UpdateOneID returns an update builder for the given id.

func (*LikeCommentClient) Use

func (c *LikeCommentClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `likecomment.Hooks(f(g(h())))`.

type LikeCommentCreate

type LikeCommentCreate struct {
	// contains filtered or unexported fields
}

LikeCommentCreate is the builder for creating a LikeComment entity.

func (*LikeCommentCreate) Mutation

func (lcc *LikeCommentCreate) Mutation() *LikeCommentMutation

Mutation returns the LikeCommentMutation object of the builder.

func (*LikeCommentCreate) Save

func (lcc *LikeCommentCreate) Save(ctx context.Context) (*LikeComment, error)

Save creates the LikeComment in the database.

func (*LikeCommentCreate) SaveX

func (lcc *LikeCommentCreate) SaveX(ctx context.Context) *LikeComment

SaveX calls Save and panics if Save returns an error.

func (*LikeCommentCreate) SetAbout

func (lcc *LikeCommentCreate) SetAbout(c *Comment) *LikeCommentCreate

SetAbout sets the "about" edge to the Comment entity.

func (*LikeCommentCreate) SetAboutID

func (lcc *LikeCommentCreate) SetAboutID(id int) *LikeCommentCreate

SetAboutID sets the "about" edge to the Comment entity by ID.

func (*LikeCommentCreate) SetID

func (lcc *LikeCommentCreate) SetID(i int) *LikeCommentCreate

SetID sets the "id" field.

func (*LikeCommentCreate) SetLikedBy

func (lcc *LikeCommentCreate) SetLikedBy(k *KhumuUser) *LikeCommentCreate

SetLikedBy sets the "likedBy" edge to the KhumuUser entity.

func (*LikeCommentCreate) SetLikedByID

func (lcc *LikeCommentCreate) SetLikedByID(id string) *LikeCommentCreate

SetLikedByID sets the "likedBy" edge to the KhumuUser entity by ID.

func (*LikeCommentCreate) SetNillableAboutID

func (lcc *LikeCommentCreate) SetNillableAboutID(id *int) *LikeCommentCreate

SetNillableAboutID sets the "about" edge to the Comment entity by ID if the given value is not nil.

func (*LikeCommentCreate) SetNillableLikedByID

func (lcc *LikeCommentCreate) SetNillableLikedByID(id *string) *LikeCommentCreate

SetNillableLikedByID sets the "likedBy" edge to the KhumuUser entity by ID if the given value is not nil.

type LikeCommentCreateBulk

type LikeCommentCreateBulk struct {
	// contains filtered or unexported fields
}

LikeCommentCreateBulk is the builder for creating many LikeComment entities in bulk.

func (*LikeCommentCreateBulk) Save

func (lccb *LikeCommentCreateBulk) Save(ctx context.Context) ([]*LikeComment, error)

Save creates the LikeComment entities in the database.

func (*LikeCommentCreateBulk) SaveX

func (lccb *LikeCommentCreateBulk) SaveX(ctx context.Context) []*LikeComment

SaveX is like Save, but panics if an error occurs.

type LikeCommentDelete

type LikeCommentDelete struct {
	// contains filtered or unexported fields
}

LikeCommentDelete is the builder for deleting a LikeComment entity.

func (*LikeCommentDelete) Exec

func (lcd *LikeCommentDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*LikeCommentDelete) ExecX

func (lcd *LikeCommentDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*LikeCommentDelete) Where

Where adds a new predicate to the LikeCommentDelete builder.

type LikeCommentDeleteOne

type LikeCommentDeleteOne struct {
	// contains filtered or unexported fields
}

LikeCommentDeleteOne is the builder for deleting a single LikeComment entity.

func (*LikeCommentDeleteOne) Exec

func (lcdo *LikeCommentDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*LikeCommentDeleteOne) ExecX

func (lcdo *LikeCommentDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type LikeCommentEdges

type LikeCommentEdges struct {
	// LikedBy holds the value of the likedBy edge.
	LikedBy *KhumuUser `json:"likedBy,omitempty"`
	// About holds the value of the about edge.
	About *Comment `json:"about,omitempty"`
	// contains filtered or unexported fields
}

LikeCommentEdges holds the relations/edges for other nodes in the graph.

func (LikeCommentEdges) AboutOrErr

func (e LikeCommentEdges) AboutOrErr() (*Comment, error)

AboutOrErr returns the About value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (LikeCommentEdges) LikedByOrErr

func (e LikeCommentEdges) LikedByOrErr() (*KhumuUser, error)

LikedByOrErr returns the LikedBy value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

type LikeCommentGroupBy

type LikeCommentGroupBy struct {
	// contains filtered or unexported fields
}

LikeCommentGroupBy is the group-by builder for LikeComment entities.

func (*LikeCommentGroupBy) Aggregate

func (lcgb *LikeCommentGroupBy) Aggregate(fns ...AggregateFunc) *LikeCommentGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*LikeCommentGroupBy) Bool

func (lcgb *LikeCommentGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*LikeCommentGroupBy) BoolX

func (lcgb *LikeCommentGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*LikeCommentGroupBy) Bools

func (lcgb *LikeCommentGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*LikeCommentGroupBy) BoolsX

func (lcgb *LikeCommentGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*LikeCommentGroupBy) Float64

func (lcgb *LikeCommentGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*LikeCommentGroupBy) Float64X

func (lcgb *LikeCommentGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*LikeCommentGroupBy) Float64s

func (lcgb *LikeCommentGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*LikeCommentGroupBy) Float64sX

func (lcgb *LikeCommentGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*LikeCommentGroupBy) Int

func (lcgb *LikeCommentGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*LikeCommentGroupBy) IntX

func (lcgb *LikeCommentGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*LikeCommentGroupBy) Ints

func (lcgb *LikeCommentGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*LikeCommentGroupBy) IntsX

func (lcgb *LikeCommentGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*LikeCommentGroupBy) Scan

func (lcgb *LikeCommentGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*LikeCommentGroupBy) ScanX

func (lcgb *LikeCommentGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*LikeCommentGroupBy) String

func (lcgb *LikeCommentGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*LikeCommentGroupBy) StringX

func (lcgb *LikeCommentGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*LikeCommentGroupBy) Strings

func (lcgb *LikeCommentGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*LikeCommentGroupBy) StringsX

func (lcgb *LikeCommentGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type LikeCommentMutation

type LikeCommentMutation struct {
	// contains filtered or unexported fields
}

LikeCommentMutation represents an operation that mutates the LikeComment nodes in the graph.

func (*LikeCommentMutation) AboutCleared

func (m *LikeCommentMutation) AboutCleared() bool

AboutCleared reports if the "about" edge to the Comment entity was cleared.

func (*LikeCommentMutation) AboutID

func (m *LikeCommentMutation) AboutID() (id int, exists bool)

AboutID returns the "about" edge ID in the mutation.

func (*LikeCommentMutation) AboutIDs

func (m *LikeCommentMutation) AboutIDs() (ids []int)

AboutIDs returns the "about" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use AboutID instead. It exists only for internal usage by the builders.

func (*LikeCommentMutation) AddField

func (m *LikeCommentMutation) 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 (*LikeCommentMutation) AddedEdges

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

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

func (*LikeCommentMutation) AddedField

func (m *LikeCommentMutation) 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 (*LikeCommentMutation) AddedFields

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

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

func (*LikeCommentMutation) AddedIDs

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

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*LikeCommentMutation) ClearAbout

func (m *LikeCommentMutation) ClearAbout()

ClearAbout clears the "about" edge to the Comment entity.

func (*LikeCommentMutation) ClearEdge

func (m *LikeCommentMutation) 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 (*LikeCommentMutation) ClearField

func (m *LikeCommentMutation) 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 (*LikeCommentMutation) ClearLikedBy

func (m *LikeCommentMutation) ClearLikedBy()

ClearLikedBy clears the "likedBy" edge to the KhumuUser entity.

func (*LikeCommentMutation) ClearedEdges

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

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

func (*LikeCommentMutation) ClearedFields

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

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

func (LikeCommentMutation) Client

func (m LikeCommentMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*LikeCommentMutation) EdgeCleared

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

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*LikeCommentMutation) Field

func (m *LikeCommentMutation) 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 (*LikeCommentMutation) FieldCleared

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

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*LikeCommentMutation) Fields

func (m *LikeCommentMutation) 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 (*LikeCommentMutation) ID

func (m *LikeCommentMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder.

func (*LikeCommentMutation) LikedByCleared

func (m *LikeCommentMutation) LikedByCleared() bool

LikedByCleared reports if the "likedBy" edge to the KhumuUser entity was cleared.

func (*LikeCommentMutation) LikedByID

func (m *LikeCommentMutation) LikedByID() (id string, exists bool)

LikedByID returns the "likedBy" edge ID in the mutation.

func (*LikeCommentMutation) LikedByIDs

func (m *LikeCommentMutation) LikedByIDs() (ids []string)

LikedByIDs returns the "likedBy" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use LikedByID instead. It exists only for internal usage by the builders.

func (*LikeCommentMutation) OldField

func (m *LikeCommentMutation) 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 (*LikeCommentMutation) Op

func (m *LikeCommentMutation) Op() Op

Op returns the operation name.

func (*LikeCommentMutation) RemovedEdges

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

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

func (*LikeCommentMutation) RemovedIDs

func (m *LikeCommentMutation) 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 (*LikeCommentMutation) ResetAbout

func (m *LikeCommentMutation) ResetAbout()

ResetAbout resets all changes to the "about" edge.

func (*LikeCommentMutation) ResetEdge

func (m *LikeCommentMutation) 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 (*LikeCommentMutation) ResetField

func (m *LikeCommentMutation) 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 (*LikeCommentMutation) ResetLikedBy

func (m *LikeCommentMutation) ResetLikedBy()

ResetLikedBy resets all changes to the "likedBy" edge.

func (*LikeCommentMutation) SetAboutID

func (m *LikeCommentMutation) SetAboutID(id int)

SetAboutID sets the "about" edge to the Comment entity by id.

func (*LikeCommentMutation) SetField

func (m *LikeCommentMutation) 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 (*LikeCommentMutation) SetID

func (m *LikeCommentMutation) SetID(id int)

SetID sets the value of the id field. Note that this operation is only accepted on creation of LikeComment entities.

func (*LikeCommentMutation) SetLikedByID

func (m *LikeCommentMutation) SetLikedByID(id string)

SetLikedByID sets the "likedBy" edge to the KhumuUser entity by id.

func (LikeCommentMutation) Tx

func (m LikeCommentMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*LikeCommentMutation) Type

func (m *LikeCommentMutation) Type() string

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

type LikeCommentQuery

type LikeCommentQuery struct {
	// contains filtered or unexported fields
}

LikeCommentQuery is the builder for querying LikeComment entities.

func (*LikeCommentQuery) All

func (lcq *LikeCommentQuery) All(ctx context.Context) ([]*LikeComment, error)

All executes the query and returns a list of LikeComments.

func (*LikeCommentQuery) AllX

func (lcq *LikeCommentQuery) AllX(ctx context.Context) []*LikeComment

AllX is like All, but panics if an error occurs.

func (*LikeCommentQuery) Clone

func (lcq *LikeCommentQuery) Clone() *LikeCommentQuery

Clone returns a duplicate of the LikeCommentQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*LikeCommentQuery) Count

func (lcq *LikeCommentQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*LikeCommentQuery) CountX

func (lcq *LikeCommentQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*LikeCommentQuery) Exist

func (lcq *LikeCommentQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*LikeCommentQuery) ExistX

func (lcq *LikeCommentQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*LikeCommentQuery) First

func (lcq *LikeCommentQuery) First(ctx context.Context) (*LikeComment, error)

First returns the first LikeComment entity from the query. Returns a *NotFoundError when no LikeComment was found.

func (*LikeCommentQuery) FirstID

func (lcq *LikeCommentQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first LikeComment ID from the query. Returns a *NotFoundError when no LikeComment ID was found.

func (*LikeCommentQuery) FirstIDX

func (lcq *LikeCommentQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*LikeCommentQuery) FirstX

func (lcq *LikeCommentQuery) FirstX(ctx context.Context) *LikeComment

FirstX is like First, but panics if an error occurs.

func (*LikeCommentQuery) GroupBy

func (lcq *LikeCommentQuery) GroupBy(field string, fields ...string) *LikeCommentGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

func (*LikeCommentQuery) IDs

func (lcq *LikeCommentQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of LikeComment IDs.

func (*LikeCommentQuery) IDsX

func (lcq *LikeCommentQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*LikeCommentQuery) Limit

func (lcq *LikeCommentQuery) Limit(limit int) *LikeCommentQuery

Limit adds a limit step to the query.

func (*LikeCommentQuery) Offset

func (lcq *LikeCommentQuery) Offset(offset int) *LikeCommentQuery

Offset adds an offset step to the query.

func (*LikeCommentQuery) Only

func (lcq *LikeCommentQuery) Only(ctx context.Context) (*LikeComment, error)

Only returns a single LikeComment entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one LikeComment entity is not found. Returns a *NotFoundError when no LikeComment entities are found.

func (*LikeCommentQuery) OnlyID

func (lcq *LikeCommentQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only LikeComment ID in the query. Returns a *NotSingularError when exactly one LikeComment ID is not found. Returns a *NotFoundError when no entities are found.

func (*LikeCommentQuery) OnlyIDX

func (lcq *LikeCommentQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*LikeCommentQuery) OnlyX

func (lcq *LikeCommentQuery) OnlyX(ctx context.Context) *LikeComment

OnlyX is like Only, but panics if an error occurs.

func (*LikeCommentQuery) Order

func (lcq *LikeCommentQuery) Order(o ...OrderFunc) *LikeCommentQuery

Order adds an order step to the query.

func (*LikeCommentQuery) QueryAbout

func (lcq *LikeCommentQuery) QueryAbout() *CommentQuery

QueryAbout chains the current query on the "about" edge.

func (*LikeCommentQuery) QueryLikedBy

func (lcq *LikeCommentQuery) QueryLikedBy() *KhumuUserQuery

QueryLikedBy chains the current query on the "likedBy" edge.

func (*LikeCommentQuery) Select

func (lcq *LikeCommentQuery) Select(field string, fields ...string) *LikeCommentSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

func (*LikeCommentQuery) Unique

func (lcq *LikeCommentQuery) Unique(unique bool) *LikeCommentQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*LikeCommentQuery) Where

Where adds a new predicate for the LikeCommentQuery builder.

func (*LikeCommentQuery) WithAbout

func (lcq *LikeCommentQuery) WithAbout(opts ...func(*CommentQuery)) *LikeCommentQuery

WithAbout tells the query-builder to eager-load the nodes that are connected to the "about" edge. The optional arguments are used to configure the query builder of the edge.

func (*LikeCommentQuery) WithLikedBy

func (lcq *LikeCommentQuery) WithLikedBy(opts ...func(*KhumuUserQuery)) *LikeCommentQuery

WithLikedBy tells the query-builder to eager-load the nodes that are connected to the "likedBy" edge. The optional arguments are used to configure the query builder of the edge.

type LikeCommentSelect

type LikeCommentSelect struct {
	*LikeCommentQuery
	// contains filtered or unexported fields
}

LikeCommentSelect is the builder for selecting fields of LikeComment entities.

func (*LikeCommentSelect) Bool

func (lcs *LikeCommentSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*LikeCommentSelect) BoolX

func (lcs *LikeCommentSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*LikeCommentSelect) Bools

func (lcs *LikeCommentSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*LikeCommentSelect) BoolsX

func (lcs *LikeCommentSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*LikeCommentSelect) Float64

func (lcs *LikeCommentSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*LikeCommentSelect) Float64X

func (lcs *LikeCommentSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*LikeCommentSelect) Float64s

func (lcs *LikeCommentSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*LikeCommentSelect) Float64sX

func (lcs *LikeCommentSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*LikeCommentSelect) Int

func (lcs *LikeCommentSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*LikeCommentSelect) IntX

func (lcs *LikeCommentSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*LikeCommentSelect) Ints

func (lcs *LikeCommentSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*LikeCommentSelect) IntsX

func (lcs *LikeCommentSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*LikeCommentSelect) Scan

func (lcs *LikeCommentSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*LikeCommentSelect) ScanX

func (lcs *LikeCommentSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*LikeCommentSelect) String

func (lcs *LikeCommentSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*LikeCommentSelect) StringX

func (lcs *LikeCommentSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*LikeCommentSelect) Strings

func (lcs *LikeCommentSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*LikeCommentSelect) StringsX

func (lcs *LikeCommentSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type LikeCommentUpdate

type LikeCommentUpdate struct {
	// contains filtered or unexported fields
}

LikeCommentUpdate is the builder for updating LikeComment entities.

func (*LikeCommentUpdate) ClearAbout

func (lcu *LikeCommentUpdate) ClearAbout() *LikeCommentUpdate

ClearAbout clears the "about" edge to the Comment entity.

func (*LikeCommentUpdate) ClearLikedBy

func (lcu *LikeCommentUpdate) ClearLikedBy() *LikeCommentUpdate

ClearLikedBy clears the "likedBy" edge to the KhumuUser entity.

func (*LikeCommentUpdate) Exec

func (lcu *LikeCommentUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*LikeCommentUpdate) ExecX

func (lcu *LikeCommentUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*LikeCommentUpdate) Mutation

func (lcu *LikeCommentUpdate) Mutation() *LikeCommentMutation

Mutation returns the LikeCommentMutation object of the builder.

func (*LikeCommentUpdate) Save

func (lcu *LikeCommentUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*LikeCommentUpdate) SaveX

func (lcu *LikeCommentUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*LikeCommentUpdate) SetAbout

func (lcu *LikeCommentUpdate) SetAbout(c *Comment) *LikeCommentUpdate

SetAbout sets the "about" edge to the Comment entity.

func (*LikeCommentUpdate) SetAboutID

func (lcu *LikeCommentUpdate) SetAboutID(id int) *LikeCommentUpdate

SetAboutID sets the "about" edge to the Comment entity by ID.

func (*LikeCommentUpdate) SetLikedBy

func (lcu *LikeCommentUpdate) SetLikedBy(k *KhumuUser) *LikeCommentUpdate

SetLikedBy sets the "likedBy" edge to the KhumuUser entity.

func (*LikeCommentUpdate) SetLikedByID

func (lcu *LikeCommentUpdate) SetLikedByID(id string) *LikeCommentUpdate

SetLikedByID sets the "likedBy" edge to the KhumuUser entity by ID.

func (*LikeCommentUpdate) SetNillableAboutID

func (lcu *LikeCommentUpdate) SetNillableAboutID(id *int) *LikeCommentUpdate

SetNillableAboutID sets the "about" edge to the Comment entity by ID if the given value is not nil.

func (*LikeCommentUpdate) SetNillableLikedByID

func (lcu *LikeCommentUpdate) SetNillableLikedByID(id *string) *LikeCommentUpdate

SetNillableLikedByID sets the "likedBy" edge to the KhumuUser entity by ID if the given value is not nil.

func (*LikeCommentUpdate) Where

Where adds a new predicate for the LikeCommentUpdate builder.

type LikeCommentUpdateOne

type LikeCommentUpdateOne struct {
	// contains filtered or unexported fields
}

LikeCommentUpdateOne is the builder for updating a single LikeComment entity.

func (*LikeCommentUpdateOne) ClearAbout

func (lcuo *LikeCommentUpdateOne) ClearAbout() *LikeCommentUpdateOne

ClearAbout clears the "about" edge to the Comment entity.

func (*LikeCommentUpdateOne) ClearLikedBy

func (lcuo *LikeCommentUpdateOne) ClearLikedBy() *LikeCommentUpdateOne

ClearLikedBy clears the "likedBy" edge to the KhumuUser entity.

func (*LikeCommentUpdateOne) Exec

func (lcuo *LikeCommentUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*LikeCommentUpdateOne) ExecX

func (lcuo *LikeCommentUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*LikeCommentUpdateOne) Mutation

func (lcuo *LikeCommentUpdateOne) Mutation() *LikeCommentMutation

Mutation returns the LikeCommentMutation object of the builder.

func (*LikeCommentUpdateOne) Save

Save executes the query and returns the updated LikeComment entity.

func (*LikeCommentUpdateOne) SaveX

func (lcuo *LikeCommentUpdateOne) SaveX(ctx context.Context) *LikeComment

SaveX is like Save, but panics if an error occurs.

func (*LikeCommentUpdateOne) Select

func (lcuo *LikeCommentUpdateOne) Select(field string, fields ...string) *LikeCommentUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*LikeCommentUpdateOne) SetAbout

SetAbout sets the "about" edge to the Comment entity.

func (*LikeCommentUpdateOne) SetAboutID

func (lcuo *LikeCommentUpdateOne) SetAboutID(id int) *LikeCommentUpdateOne

SetAboutID sets the "about" edge to the Comment entity by ID.

func (*LikeCommentUpdateOne) SetLikedBy

func (lcuo *LikeCommentUpdateOne) SetLikedBy(k *KhumuUser) *LikeCommentUpdateOne

SetLikedBy sets the "likedBy" edge to the KhumuUser entity.

func (*LikeCommentUpdateOne) SetLikedByID

func (lcuo *LikeCommentUpdateOne) SetLikedByID(id string) *LikeCommentUpdateOne

SetLikedByID sets the "likedBy" edge to the KhumuUser entity by ID.

func (*LikeCommentUpdateOne) SetNillableAboutID

func (lcuo *LikeCommentUpdateOne) SetNillableAboutID(id *int) *LikeCommentUpdateOne

SetNillableAboutID sets the "about" edge to the Comment entity by ID if the given value is not nil.

func (*LikeCommentUpdateOne) SetNillableLikedByID

func (lcuo *LikeCommentUpdateOne) SetNillableLikedByID(id *string) *LikeCommentUpdateOne

SetNillableLikedByID sets the "likedBy" edge to the KhumuUser entity by ID if the given value is not nil.

type LikeComments

type LikeComments []*LikeComment

LikeComments is a parsable slice of LikeComment.

type MutateFunc

type MutateFunc = ent.MutateFunc

ent aliases to avoid import conflicts in user's code.

type Mutation

type Mutation = ent.Mutation

ent aliases to avoid import conflicts in user's code.

type Mutator

type Mutator = ent.Mutator

ent aliases to avoid import conflicts in user's code.

type NotFoundError

type NotFoundError struct {
	// contains filtered or unexported fields
}

NotFoundError returns when trying to fetch a specific entity and it was not found in the database.

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

type NotLoadedError struct {
	// contains filtered or unexported fields
}

NotLoadedError returns when trying to get a node that was not loaded by the query.

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

type NotSingularError struct {
	// contains filtered or unexported fields
}

NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

ent aliases to avoid import conflicts in user's code.

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

func Log(fn func(...interface{})) Option

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Policy

type Policy = ent.Policy

ent aliases to avoid import conflicts in user's code.

type Query

type Query = ent.Query

ent aliases to avoid import conflicts in user's code.

type RollbackFunc

type RollbackFunc func(context.Context, *Tx) error

The RollbackFunc type is an adapter to allow the use of ordinary function as a Rollbacker. If f is a function with the appropriate signature, RollbackFunc(f) is a Rollbacker that calls f.

func (RollbackFunc) Rollback

func (f RollbackFunc) Rollback(ctx context.Context, tx *Tx) error

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

RollbackHook defines the "rollback middleware". A function that gets a Rollbacker and returns a Rollbacker. For example:

hook := func(next ent.Rollbacker) ent.Rollbacker {
	return ent.RollbackFunc(func(context.Context, tx *ent.Tx) error {
		// Do some stuff before.
		if err := next.Rollback(ctx, tx); err != nil {
			return err
		}
		// Do some stuff after.
		return nil
	})
}

type Rollbacker

type Rollbacker interface {
	Rollback(context.Context, *Tx) error
}

Rollbacker is the interface that wraps the Rollbacker method.

type StudyArticle

type StudyArticle struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the StudyArticleQuery when eager-loading is set.
	Edges StudyArticleEdges `json:"edges"`
	// contains filtered or unexported fields
}

StudyArticle is the model entity for the StudyArticle schema.

func (*StudyArticle) QueryAuthor

func (sa *StudyArticle) QueryAuthor() *KhumuUserQuery

QueryAuthor queries the "author" edge of the StudyArticle entity.

func (*StudyArticle) QueryComments

func (sa *StudyArticle) QueryComments() *CommentQuery

QueryComments queries the "comments" edge of the StudyArticle entity.

func (*StudyArticle) String

func (sa *StudyArticle) String() string

String implements the fmt.Stringer.

func (*StudyArticle) Unwrap

func (sa *StudyArticle) Unwrap() *StudyArticle

Unwrap unwraps the StudyArticle entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*StudyArticle) Update

func (sa *StudyArticle) Update() *StudyArticleUpdateOne

Update returns a builder for updating this StudyArticle. Note that you need to call StudyArticle.Unwrap() before calling this method if this StudyArticle was returned from a transaction, and the transaction was committed or rolled back.

type StudyArticleClient

type StudyArticleClient struct {
	// contains filtered or unexported fields
}

StudyArticleClient is a client for the StudyArticle schema.

func NewStudyArticleClient

func NewStudyArticleClient(c config) *StudyArticleClient

NewStudyArticleClient returns a client for the StudyArticle from the given config.

func (*StudyArticleClient) Create

Create returns a create builder for StudyArticle.

func (*StudyArticleClient) CreateBulk

func (c *StudyArticleClient) CreateBulk(builders ...*StudyArticleCreate) *StudyArticleCreateBulk

CreateBulk returns a builder for creating a bulk of StudyArticle entities.

func (*StudyArticleClient) Delete

Delete returns a delete builder for StudyArticle.

func (*StudyArticleClient) DeleteOne

DeleteOne returns a delete builder for the given entity.

func (*StudyArticleClient) DeleteOneID

func (c *StudyArticleClient) DeleteOneID(id int) *StudyArticleDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*StudyArticleClient) Get

Get returns a StudyArticle entity by its id.

func (*StudyArticleClient) GetX

GetX is like Get, but panics if an error occurs.

func (*StudyArticleClient) Hooks

func (c *StudyArticleClient) Hooks() []Hook

Hooks returns the client hooks.

func (*StudyArticleClient) Query

Query returns a query builder for StudyArticle.

func (*StudyArticleClient) QueryAuthor

func (c *StudyArticleClient) QueryAuthor(sa *StudyArticle) *KhumuUserQuery

QueryAuthor queries the author edge of a StudyArticle.

func (*StudyArticleClient) QueryComments

func (c *StudyArticleClient) QueryComments(sa *StudyArticle) *CommentQuery

QueryComments queries the comments edge of a StudyArticle.

func (*StudyArticleClient) Update

Update returns an update builder for StudyArticle.

func (*StudyArticleClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*StudyArticleClient) UpdateOneID

func (c *StudyArticleClient) UpdateOneID(id int) *StudyArticleUpdateOne

UpdateOneID returns an update builder for the given id.

func (*StudyArticleClient) Use

func (c *StudyArticleClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `studyarticle.Hooks(f(g(h())))`.

type StudyArticleCreate

type StudyArticleCreate struct {
	// contains filtered or unexported fields
}

StudyArticleCreate is the builder for creating a StudyArticle entity.

func (*StudyArticleCreate) AddCommentIDs

func (sac *StudyArticleCreate) AddCommentIDs(ids ...int) *StudyArticleCreate

AddCommentIDs adds the "comments" edge to the Comment entity by IDs.

func (*StudyArticleCreate) AddComments

func (sac *StudyArticleCreate) AddComments(c ...*Comment) *StudyArticleCreate

AddComments adds the "comments" edges to the Comment entity.

func (*StudyArticleCreate) Mutation

func (sac *StudyArticleCreate) Mutation() *StudyArticleMutation

Mutation returns the StudyArticleMutation object of the builder.

func (*StudyArticleCreate) Save

Save creates the StudyArticle in the database.

func (*StudyArticleCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*StudyArticleCreate) SetAuthor

func (sac *StudyArticleCreate) SetAuthor(k *KhumuUser) *StudyArticleCreate

SetAuthor sets the "author" edge to the KhumuUser entity.

func (*StudyArticleCreate) SetAuthorID

func (sac *StudyArticleCreate) SetAuthorID(id string) *StudyArticleCreate

SetAuthorID sets the "author" edge to the KhumuUser entity by ID.

func (*StudyArticleCreate) SetID

func (sac *StudyArticleCreate) SetID(i int) *StudyArticleCreate

SetID sets the "id" field.

func (*StudyArticleCreate) SetNillableAuthorID

func (sac *StudyArticleCreate) SetNillableAuthorID(id *string) *StudyArticleCreate

SetNillableAuthorID sets the "author" edge to the KhumuUser entity by ID if the given value is not nil.

type StudyArticleCreateBulk

type StudyArticleCreateBulk struct {
	// contains filtered or unexported fields
}

StudyArticleCreateBulk is the builder for creating many StudyArticle entities in bulk.

func (*StudyArticleCreateBulk) Save

Save creates the StudyArticle entities in the database.

func (*StudyArticleCreateBulk) SaveX

func (sacb *StudyArticleCreateBulk) SaveX(ctx context.Context) []*StudyArticle

SaveX is like Save, but panics if an error occurs.

type StudyArticleDelete

type StudyArticleDelete struct {
	// contains filtered or unexported fields
}

StudyArticleDelete is the builder for deleting a StudyArticle entity.

func (*StudyArticleDelete) Exec

func (sad *StudyArticleDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*StudyArticleDelete) ExecX

func (sad *StudyArticleDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*StudyArticleDelete) Where

Where adds a new predicate to the StudyArticleDelete builder.

type StudyArticleDeleteOne

type StudyArticleDeleteOne struct {
	// contains filtered or unexported fields
}

StudyArticleDeleteOne is the builder for deleting a single StudyArticle entity.

func (*StudyArticleDeleteOne) Exec

func (sado *StudyArticleDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*StudyArticleDeleteOne) ExecX

func (sado *StudyArticleDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type StudyArticleEdges

type StudyArticleEdges struct {
	// Comments holds the value of the comments edge.
	Comments []*Comment `json:"comments,omitempty"`
	// Author holds the value of the author edge.
	Author *KhumuUser `json:"author,omitempty"`
	// contains filtered or unexported fields
}

StudyArticleEdges holds the relations/edges for other nodes in the graph.

func (StudyArticleEdges) AuthorOrErr

func (e StudyArticleEdges) AuthorOrErr() (*KhumuUser, error)

AuthorOrErr returns the Author value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (StudyArticleEdges) CommentsOrErr

func (e StudyArticleEdges) CommentsOrErr() ([]*Comment, error)

CommentsOrErr returns the Comments value or an error if the edge was not loaded in eager-loading.

type StudyArticleGroupBy

type StudyArticleGroupBy struct {
	// contains filtered or unexported fields
}

StudyArticleGroupBy is the group-by builder for StudyArticle entities.

func (*StudyArticleGroupBy) Aggregate

func (sagb *StudyArticleGroupBy) Aggregate(fns ...AggregateFunc) *StudyArticleGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*StudyArticleGroupBy) Bool

func (sagb *StudyArticleGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*StudyArticleGroupBy) BoolX

func (sagb *StudyArticleGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*StudyArticleGroupBy) Bools

func (sagb *StudyArticleGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*StudyArticleGroupBy) BoolsX

func (sagb *StudyArticleGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*StudyArticleGroupBy) Float64

func (sagb *StudyArticleGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*StudyArticleGroupBy) Float64X

func (sagb *StudyArticleGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*StudyArticleGroupBy) Float64s

func (sagb *StudyArticleGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*StudyArticleGroupBy) Float64sX

func (sagb *StudyArticleGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*StudyArticleGroupBy) Int

func (sagb *StudyArticleGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*StudyArticleGroupBy) IntX

func (sagb *StudyArticleGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*StudyArticleGroupBy) Ints

func (sagb *StudyArticleGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*StudyArticleGroupBy) IntsX

func (sagb *StudyArticleGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*StudyArticleGroupBy) Scan

func (sagb *StudyArticleGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*StudyArticleGroupBy) ScanX

func (sagb *StudyArticleGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*StudyArticleGroupBy) String

func (sagb *StudyArticleGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*StudyArticleGroupBy) StringX

func (sagb *StudyArticleGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*StudyArticleGroupBy) Strings

func (sagb *StudyArticleGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*StudyArticleGroupBy) StringsX

func (sagb *StudyArticleGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type StudyArticleMutation

type StudyArticleMutation struct {
	// contains filtered or unexported fields
}

StudyArticleMutation represents an operation that mutates the StudyArticle nodes in the graph.

func (*StudyArticleMutation) AddCommentIDs

func (m *StudyArticleMutation) AddCommentIDs(ids ...int)

AddCommentIDs adds the "comments" edge to the Comment entity by ids.

func (*StudyArticleMutation) AddField

func (m *StudyArticleMutation) 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 (*StudyArticleMutation) AddedEdges

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

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

func (*StudyArticleMutation) AddedField

func (m *StudyArticleMutation) 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 (*StudyArticleMutation) AddedFields

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

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

func (*StudyArticleMutation) AddedIDs

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

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*StudyArticleMutation) AuthorCleared

func (m *StudyArticleMutation) AuthorCleared() bool

AuthorCleared reports if the "author" edge to the KhumuUser entity was cleared.

func (*StudyArticleMutation) AuthorID

func (m *StudyArticleMutation) AuthorID() (id string, exists bool)

AuthorID returns the "author" edge ID in the mutation.

func (*StudyArticleMutation) AuthorIDs

func (m *StudyArticleMutation) AuthorIDs() (ids []string)

AuthorIDs returns the "author" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use AuthorID instead. It exists only for internal usage by the builders.

func (*StudyArticleMutation) ClearAuthor

func (m *StudyArticleMutation) ClearAuthor()

ClearAuthor clears the "author" edge to the KhumuUser entity.

func (*StudyArticleMutation) ClearComments

func (m *StudyArticleMutation) ClearComments()

ClearComments clears the "comments" edge to the Comment entity.

func (*StudyArticleMutation) ClearEdge

func (m *StudyArticleMutation) 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 (*StudyArticleMutation) ClearField

func (m *StudyArticleMutation) 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 (*StudyArticleMutation) ClearedEdges

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

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

func (*StudyArticleMutation) ClearedFields

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

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

func (StudyArticleMutation) Client

func (m StudyArticleMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*StudyArticleMutation) CommentsCleared

func (m *StudyArticleMutation) CommentsCleared() bool

CommentsCleared reports if the "comments" edge to the Comment entity was cleared.

func (*StudyArticleMutation) CommentsIDs

func (m *StudyArticleMutation) CommentsIDs() (ids []int)

CommentsIDs returns the "comments" edge IDs in the mutation.

func (*StudyArticleMutation) EdgeCleared

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

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*StudyArticleMutation) Field

func (m *StudyArticleMutation) 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 (*StudyArticleMutation) FieldCleared

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

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*StudyArticleMutation) Fields

func (m *StudyArticleMutation) 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 (*StudyArticleMutation) ID

func (m *StudyArticleMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder.

func (*StudyArticleMutation) OldField

func (m *StudyArticleMutation) 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 (*StudyArticleMutation) Op

func (m *StudyArticleMutation) Op() Op

Op returns the operation name.

func (*StudyArticleMutation) RemoveCommentIDs

func (m *StudyArticleMutation) RemoveCommentIDs(ids ...int)

RemoveCommentIDs removes the "comments" edge to the Comment entity by IDs.

func (*StudyArticleMutation) RemovedCommentsIDs

func (m *StudyArticleMutation) RemovedCommentsIDs() (ids []int)

RemovedComments returns the removed IDs of the "comments" edge to the Comment entity.

func (*StudyArticleMutation) RemovedEdges

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

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

func (*StudyArticleMutation) RemovedIDs

func (m *StudyArticleMutation) 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 (*StudyArticleMutation) ResetAuthor

func (m *StudyArticleMutation) ResetAuthor()

ResetAuthor resets all changes to the "author" edge.

func (*StudyArticleMutation) ResetComments

func (m *StudyArticleMutation) ResetComments()

ResetComments resets all changes to the "comments" edge.

func (*StudyArticleMutation) ResetEdge

func (m *StudyArticleMutation) 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 (*StudyArticleMutation) ResetField

func (m *StudyArticleMutation) 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 (*StudyArticleMutation) SetAuthorID

func (m *StudyArticleMutation) SetAuthorID(id string)

SetAuthorID sets the "author" edge to the KhumuUser entity by id.

func (*StudyArticleMutation) SetField

func (m *StudyArticleMutation) 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 (*StudyArticleMutation) SetID

func (m *StudyArticleMutation) SetID(id int)

SetID sets the value of the id field. Note that this operation is only accepted on creation of StudyArticle entities.

func (StudyArticleMutation) Tx

func (m StudyArticleMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*StudyArticleMutation) Type

func (m *StudyArticleMutation) Type() string

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

type StudyArticleQuery

type StudyArticleQuery struct {
	// contains filtered or unexported fields
}

StudyArticleQuery is the builder for querying StudyArticle entities.

func (*StudyArticleQuery) All

func (saq *StudyArticleQuery) All(ctx context.Context) ([]*StudyArticle, error)

All executes the query and returns a list of StudyArticles.

func (*StudyArticleQuery) AllX

func (saq *StudyArticleQuery) AllX(ctx context.Context) []*StudyArticle

AllX is like All, but panics if an error occurs.

func (*StudyArticleQuery) Clone

func (saq *StudyArticleQuery) Clone() *StudyArticleQuery

Clone returns a duplicate of the StudyArticleQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*StudyArticleQuery) Count

func (saq *StudyArticleQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*StudyArticleQuery) CountX

func (saq *StudyArticleQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*StudyArticleQuery) Exist

func (saq *StudyArticleQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*StudyArticleQuery) ExistX

func (saq *StudyArticleQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*StudyArticleQuery) First

func (saq *StudyArticleQuery) First(ctx context.Context) (*StudyArticle, error)

First returns the first StudyArticle entity from the query. Returns a *NotFoundError when no StudyArticle was found.

func (*StudyArticleQuery) FirstID

func (saq *StudyArticleQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first StudyArticle ID from the query. Returns a *NotFoundError when no StudyArticle ID was found.

func (*StudyArticleQuery) FirstIDX

func (saq *StudyArticleQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*StudyArticleQuery) FirstX

func (saq *StudyArticleQuery) FirstX(ctx context.Context) *StudyArticle

FirstX is like First, but panics if an error occurs.

func (*StudyArticleQuery) GroupBy

func (saq *StudyArticleQuery) GroupBy(field string, fields ...string) *StudyArticleGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

func (*StudyArticleQuery) IDs

func (saq *StudyArticleQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of StudyArticle IDs.

func (*StudyArticleQuery) IDsX

func (saq *StudyArticleQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*StudyArticleQuery) Limit

func (saq *StudyArticleQuery) Limit(limit int) *StudyArticleQuery

Limit adds a limit step to the query.

func (*StudyArticleQuery) Offset

func (saq *StudyArticleQuery) Offset(offset int) *StudyArticleQuery

Offset adds an offset step to the query.

func (*StudyArticleQuery) Only

func (saq *StudyArticleQuery) Only(ctx context.Context) (*StudyArticle, error)

Only returns a single StudyArticle entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one StudyArticle entity is not found. Returns a *NotFoundError when no StudyArticle entities are found.

func (*StudyArticleQuery) OnlyID

func (saq *StudyArticleQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only StudyArticle ID in the query. Returns a *NotSingularError when exactly one StudyArticle ID is not found. Returns a *NotFoundError when no entities are found.

func (*StudyArticleQuery) OnlyIDX

func (saq *StudyArticleQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*StudyArticleQuery) OnlyX

func (saq *StudyArticleQuery) OnlyX(ctx context.Context) *StudyArticle

OnlyX is like Only, but panics if an error occurs.

func (*StudyArticleQuery) Order

func (saq *StudyArticleQuery) Order(o ...OrderFunc) *StudyArticleQuery

Order adds an order step to the query.

func (*StudyArticleQuery) QueryAuthor

func (saq *StudyArticleQuery) QueryAuthor() *KhumuUserQuery

QueryAuthor chains the current query on the "author" edge.

func (*StudyArticleQuery) QueryComments

func (saq *StudyArticleQuery) QueryComments() *CommentQuery

QueryComments chains the current query on the "comments" edge.

func (*StudyArticleQuery) Select

func (saq *StudyArticleQuery) Select(field string, fields ...string) *StudyArticleSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

func (*StudyArticleQuery) Unique

func (saq *StudyArticleQuery) Unique(unique bool) *StudyArticleQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*StudyArticleQuery) Where

Where adds a new predicate for the StudyArticleQuery builder.

func (*StudyArticleQuery) WithAuthor

func (saq *StudyArticleQuery) WithAuthor(opts ...func(*KhumuUserQuery)) *StudyArticleQuery

WithAuthor tells the query-builder to eager-load the nodes that are connected to the "author" edge. The optional arguments are used to configure the query builder of the edge.

func (*StudyArticleQuery) WithComments

func (saq *StudyArticleQuery) WithComments(opts ...func(*CommentQuery)) *StudyArticleQuery

WithComments tells the query-builder to eager-load the nodes that are connected to the "comments" edge. The optional arguments are used to configure the query builder of the edge.

type StudyArticleSelect

type StudyArticleSelect struct {
	*StudyArticleQuery
	// contains filtered or unexported fields
}

StudyArticleSelect is the builder for selecting fields of StudyArticle entities.

func (*StudyArticleSelect) Bool

func (sas *StudyArticleSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*StudyArticleSelect) BoolX

func (sas *StudyArticleSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*StudyArticleSelect) Bools

func (sas *StudyArticleSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*StudyArticleSelect) BoolsX

func (sas *StudyArticleSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*StudyArticleSelect) Float64

func (sas *StudyArticleSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*StudyArticleSelect) Float64X

func (sas *StudyArticleSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*StudyArticleSelect) Float64s

func (sas *StudyArticleSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*StudyArticleSelect) Float64sX

func (sas *StudyArticleSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*StudyArticleSelect) Int

func (sas *StudyArticleSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*StudyArticleSelect) IntX

func (sas *StudyArticleSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*StudyArticleSelect) Ints

func (sas *StudyArticleSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*StudyArticleSelect) IntsX

func (sas *StudyArticleSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*StudyArticleSelect) Scan

func (sas *StudyArticleSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*StudyArticleSelect) ScanX

func (sas *StudyArticleSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*StudyArticleSelect) String

func (sas *StudyArticleSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*StudyArticleSelect) StringX

func (sas *StudyArticleSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*StudyArticleSelect) Strings

func (sas *StudyArticleSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*StudyArticleSelect) StringsX

func (sas *StudyArticleSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type StudyArticleUpdate

type StudyArticleUpdate struct {
	// contains filtered or unexported fields
}

StudyArticleUpdate is the builder for updating StudyArticle entities.

func (*StudyArticleUpdate) AddCommentIDs

func (sau *StudyArticleUpdate) AddCommentIDs(ids ...int) *StudyArticleUpdate

AddCommentIDs adds the "comments" edge to the Comment entity by IDs.

func (*StudyArticleUpdate) AddComments

func (sau *StudyArticleUpdate) AddComments(c ...*Comment) *StudyArticleUpdate

AddComments adds the "comments" edges to the Comment entity.

func (*StudyArticleUpdate) ClearAuthor

func (sau *StudyArticleUpdate) ClearAuthor() *StudyArticleUpdate

ClearAuthor clears the "author" edge to the KhumuUser entity.

func (*StudyArticleUpdate) ClearComments

func (sau *StudyArticleUpdate) ClearComments() *StudyArticleUpdate

ClearComments clears all "comments" edges to the Comment entity.

func (*StudyArticleUpdate) Exec

func (sau *StudyArticleUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*StudyArticleUpdate) ExecX

func (sau *StudyArticleUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*StudyArticleUpdate) Mutation

func (sau *StudyArticleUpdate) Mutation() *StudyArticleMutation

Mutation returns the StudyArticleMutation object of the builder.

func (*StudyArticleUpdate) RemoveCommentIDs

func (sau *StudyArticleUpdate) RemoveCommentIDs(ids ...int) *StudyArticleUpdate

RemoveCommentIDs removes the "comments" edge to Comment entities by IDs.

func (*StudyArticleUpdate) RemoveComments

func (sau *StudyArticleUpdate) RemoveComments(c ...*Comment) *StudyArticleUpdate

RemoveComments removes "comments" edges to Comment entities.

func (*StudyArticleUpdate) Save

func (sau *StudyArticleUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*StudyArticleUpdate) SaveX

func (sau *StudyArticleUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*StudyArticleUpdate) SetAuthor

func (sau *StudyArticleUpdate) SetAuthor(k *KhumuUser) *StudyArticleUpdate

SetAuthor sets the "author" edge to the KhumuUser entity.

func (*StudyArticleUpdate) SetAuthorID

func (sau *StudyArticleUpdate) SetAuthorID(id string) *StudyArticleUpdate

SetAuthorID sets the "author" edge to the KhumuUser entity by ID.

func (*StudyArticleUpdate) SetNillableAuthorID

func (sau *StudyArticleUpdate) SetNillableAuthorID(id *string) *StudyArticleUpdate

SetNillableAuthorID sets the "author" edge to the KhumuUser entity by ID if the given value is not nil.

func (*StudyArticleUpdate) Where

Where adds a new predicate for the StudyArticleUpdate builder.

type StudyArticleUpdateOne

type StudyArticleUpdateOne struct {
	// contains filtered or unexported fields
}

StudyArticleUpdateOne is the builder for updating a single StudyArticle entity.

func (*StudyArticleUpdateOne) AddCommentIDs

func (sauo *StudyArticleUpdateOne) AddCommentIDs(ids ...int) *StudyArticleUpdateOne

AddCommentIDs adds the "comments" edge to the Comment entity by IDs.

func (*StudyArticleUpdateOne) AddComments

func (sauo *StudyArticleUpdateOne) AddComments(c ...*Comment) *StudyArticleUpdateOne

AddComments adds the "comments" edges to the Comment entity.

func (*StudyArticleUpdateOne) ClearAuthor

func (sauo *StudyArticleUpdateOne) ClearAuthor() *StudyArticleUpdateOne

ClearAuthor clears the "author" edge to the KhumuUser entity.

func (*StudyArticleUpdateOne) ClearComments

func (sauo *StudyArticleUpdateOne) ClearComments() *StudyArticleUpdateOne

ClearComments clears all "comments" edges to the Comment entity.

func (*StudyArticleUpdateOne) Exec

func (sauo *StudyArticleUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*StudyArticleUpdateOne) ExecX

func (sauo *StudyArticleUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*StudyArticleUpdateOne) Mutation

func (sauo *StudyArticleUpdateOne) Mutation() *StudyArticleMutation

Mutation returns the StudyArticleMutation object of the builder.

func (*StudyArticleUpdateOne) RemoveCommentIDs

func (sauo *StudyArticleUpdateOne) RemoveCommentIDs(ids ...int) *StudyArticleUpdateOne

RemoveCommentIDs removes the "comments" edge to Comment entities by IDs.

func (*StudyArticleUpdateOne) RemoveComments

func (sauo *StudyArticleUpdateOne) RemoveComments(c ...*Comment) *StudyArticleUpdateOne

RemoveComments removes "comments" edges to Comment entities.

func (*StudyArticleUpdateOne) Save

Save executes the query and returns the updated StudyArticle entity.

func (*StudyArticleUpdateOne) SaveX

SaveX is like Save, but panics if an error occurs.

func (*StudyArticleUpdateOne) Select

func (sauo *StudyArticleUpdateOne) Select(field string, fields ...string) *StudyArticleUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*StudyArticleUpdateOne) SetAuthor

SetAuthor sets the "author" edge to the KhumuUser entity.

func (*StudyArticleUpdateOne) SetAuthorID

func (sauo *StudyArticleUpdateOne) SetAuthorID(id string) *StudyArticleUpdateOne

SetAuthorID sets the "author" edge to the KhumuUser entity by ID.

func (*StudyArticleUpdateOne) SetNillableAuthorID

func (sauo *StudyArticleUpdateOne) SetNillableAuthorID(id *string) *StudyArticleUpdateOne

SetNillableAuthorID sets the "author" edge to the KhumuUser entity by ID if the given value is not nil.

type StudyArticles

type StudyArticles []*StudyArticle

StudyArticles is a parsable slice of StudyArticle.

type Tx

type Tx struct {

	// Article is the client for interacting with the Article builders.
	Article *ArticleClient
	// Board is the client for interacting with the Board builders.
	Board *BoardClient
	// Comment is the client for interacting with the Comment builders.
	Comment *CommentClient
	// KhumuUser is the client for interacting with the KhumuUser builders.
	KhumuUser *KhumuUserClient
	// LikeComment is the client for interacting with the LikeComment builders.
	LikeComment *LikeCommentClient
	// StudyArticle is the client for interacting with the StudyArticle builders.
	StudyArticle *StudyArticleClient
	// contains filtered or unexported fields
}

Tx is a transactional client that is created by calling Client.Tx().

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

TxFromContext returns a Tx stored inside a context, or nil if there isn't one.

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

ent aliases to avoid import conflicts in user's code.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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