ent

package
v0.0.0-...-fb67617 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2020 License: Apache-2.0 Imports: 21 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.
	TypeAccess     = "Access"
	TypeGroup      = "Group"
	TypePermission = "Permission"
	TypeUser       = "User"
)

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 nor 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 Client attached.

Types

type Access

type Access struct {

	// ID of the ent.
	ID string `json:"id,omitempty"`
	// Creator holds the value of the "creator" field.
	Creator string `json:"creator,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt int64 `json:"created_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the AccessQuery when eager-loading is set.
	Edges AccessEdges `json:"edges"`
	// contains filtered or unexported fields
}

Access is the model entity for the Access schema.

func (*Access) QueryOwner

func (a *Access) QueryOwner() *UserQuery

QueryOwner queries the owner edge of the Access.

func (*Access) String

func (a *Access) String() string

String implements the fmt.Stringer.

func (*Access) Unwrap

func (a *Access) Unwrap() *Access

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

func (*Access) Update

func (a *Access) Update() *AccessUpdateOne

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

type AccessClient

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

AccessClient is a client for the Access schema.

func NewAccessClient

func NewAccessClient(c config) *AccessClient

NewAccessClient returns a client for the Access from the given config.

func (*AccessClient) Create

func (c *AccessClient) Create() *AccessCreate

Create returns a create builder for Access.

func (*AccessClient) CreateBulk

func (c *AccessClient) CreateBulk(builders ...*AccessCreate) *AccessCreateBulk

BulkCreate returns a builder for creating a bulk of Access entities.

func (*AccessClient) Delete

func (c *AccessClient) Delete() *AccessDelete

Delete returns a delete builder for Access.

func (*AccessClient) DeleteOne

func (c *AccessClient) DeleteOne(a *Access) *AccessDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*AccessClient) DeleteOneID

func (c *AccessClient) DeleteOneID(id string) *AccessDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*AccessClient) Get

func (c *AccessClient) Get(ctx context.Context, id string) (*Access, error)

Get returns a Access entity by its id.

func (*AccessClient) GetX

func (c *AccessClient) GetX(ctx context.Context, id string) *Access

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

func (*AccessClient) Hooks

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

Hooks returns the client hooks.

func (*AccessClient) Query

func (c *AccessClient) Query() *AccessQuery

Query returns a query builder for Access.

func (*AccessClient) QueryOwner

func (c *AccessClient) QueryOwner(a *Access) *UserQuery

QueryOwner queries the owner edge of a Access.

func (*AccessClient) Update

func (c *AccessClient) Update() *AccessUpdate

Update returns an update builder for Access.

func (*AccessClient) UpdateOne

func (c *AccessClient) UpdateOne(a *Access) *AccessUpdateOne

UpdateOne returns an update builder for the given entity.

func (*AccessClient) UpdateOneID

func (c *AccessClient) UpdateOneID(id string) *AccessUpdateOne

UpdateOneID returns an update builder for the given id.

func (*AccessClient) Use

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

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

type AccessCreate

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

AccessCreate is the builder for creating a Access entity.

func (*AccessCreate) Mutation

func (ac *AccessCreate) Mutation() *AccessMutation

Mutation returns the AccessMutation object of the builder.

func (*AccessCreate) Save

func (ac *AccessCreate) Save(ctx context.Context) (*Access, error)

Save creates the Access in the database.

func (*AccessCreate) SaveX

func (ac *AccessCreate) SaveX(ctx context.Context) *Access

SaveX calls Save and panics if Save returns an error.

func (*AccessCreate) SetCreatedAt

func (ac *AccessCreate) SetCreatedAt(i int64) *AccessCreate

SetCreatedAt sets the created_at field.

func (*AccessCreate) SetCreator

func (ac *AccessCreate) SetCreator(s string) *AccessCreate

SetCreator sets the creator field.

func (*AccessCreate) SetID

func (ac *AccessCreate) SetID(s string) *AccessCreate

SetID sets the id field.

func (*AccessCreate) SetNillableOwnerID

func (ac *AccessCreate) SetNillableOwnerID(id *string) *AccessCreate

SetNillableOwnerID sets the owner edge to User by id if the given value is not nil.

func (*AccessCreate) SetOwner

func (ac *AccessCreate) SetOwner(u *User) *AccessCreate

SetOwner sets the owner edge to User.

func (*AccessCreate) SetOwnerID

func (ac *AccessCreate) SetOwnerID(id string) *AccessCreate

SetOwnerID sets the owner edge to User by id.

type AccessCreateBulk

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

AccessCreateBulk is the builder for creating a bulk of Access entities.

func (*AccessCreateBulk) Save

func (acb *AccessCreateBulk) Save(ctx context.Context) ([]*Access, error)

Save creates the Access entities in the database.

func (*AccessCreateBulk) SaveX

func (acb *AccessCreateBulk) SaveX(ctx context.Context) []*Access

SaveX calls Save and panics if Save returns an error.

type AccessDelete

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

AccessDelete is the builder for deleting a Access entity.

func (*AccessDelete) Exec

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

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

func (*AccessDelete) ExecX

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

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

func (*AccessDelete) Where

func (ad *AccessDelete) Where(ps ...predicate.Access) *AccessDelete

Where adds a new predicate to the delete builder.

type AccessDeleteOne

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

AccessDeleteOne is the builder for deleting a single Access entity.

func (*AccessDeleteOne) Exec

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

Exec executes the deletion query.

func (*AccessDeleteOne) ExecX

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

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

type AccessEdges

type AccessEdges struct {
	// Owner holds the value of the owner edge.
	Owner *User
	// contains filtered or unexported fields
}

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

func (AccessEdges) OwnerOrErr

func (e AccessEdges) OwnerOrErr() (*User, error)

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

type AccessGroupBy

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

AccessGroupBy is the builder for group-by Access entities.

func (*AccessGroupBy) Aggregate

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

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

func (*AccessGroupBy) Bool

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

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

func (*AccessGroupBy) BoolX

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

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

func (*AccessGroupBy) Bools

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

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

func (*AccessGroupBy) BoolsX

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

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

func (*AccessGroupBy) Float64

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

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

func (*AccessGroupBy) Float64X

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

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

func (*AccessGroupBy) Float64s

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

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

func (*AccessGroupBy) Float64sX

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

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

func (*AccessGroupBy) Int

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

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

func (*AccessGroupBy) IntX

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

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

func (*AccessGroupBy) Ints

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

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

func (*AccessGroupBy) IntsX

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

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

func (*AccessGroupBy) Scan

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

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

func (*AccessGroupBy) ScanX

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

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

func (*AccessGroupBy) String

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

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

func (*AccessGroupBy) StringX

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

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

func (*AccessGroupBy) Strings

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

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

func (*AccessGroupBy) StringsX

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

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

type AccessMutation

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

AccessMutation represents an operation that mutate the Accesses nodes in the graph.

func (*AccessMutation) AddCreatedAt

func (m *AccessMutation) AddCreatedAt(i int64)

AddCreatedAt adds i to created_at.

func (*AccessMutation) AddField

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

AddField adds the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.

func (*AccessMutation) AddedCreatedAt

func (m *AccessMutation) AddedCreatedAt() (r int64, exists bool)

AddedCreatedAt returns the value that was added to the created_at field in this mutation.

func (*AccessMutation) AddedEdges

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

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

func (*AccessMutation) AddedField

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

AddedField returns the numeric value that was in/decremented from a field with the given name. The second value indicates that this field was not set, or was not define in the schema.

func (*AccessMutation) AddedFields

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

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

func (*AccessMutation) AddedIDs

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

AddedIDs returns all ids (to other nodes) that were added for the given edge name.

func (*AccessMutation) ClearEdge

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

ClearEdge clears the value for the given name. It returns an error if the edge name is not defined in the schema.

func (*AccessMutation) ClearField

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

ClearField clears the value for the given name. It returns an error if the field is not defined in the schema.

func (*AccessMutation) ClearOwner

func (m *AccessMutation) ClearOwner()

ClearOwner clears the owner edge to User.

func (*AccessMutation) ClearedEdges

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

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

func (*AccessMutation) ClearedFields

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

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

func (AccessMutation) Client

func (m AccessMutation) 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 (*AccessMutation) CreatedAt

func (m *AccessMutation) CreatedAt() (r int64, exists bool)

CreatedAt returns the created_at value in the mutation.

func (*AccessMutation) Creator

func (m *AccessMutation) Creator() (r string, exists bool)

Creator returns the creator value in the mutation.

func (*AccessMutation) EdgeCleared

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

EdgeCleared returns a boolean indicates if this edge was cleared in this mutation.

func (*AccessMutation) Field

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

Field returns the value of a field with the given name. The second boolean value indicates that this field was not set, or was not define in the schema.

func (*AccessMutation) FieldCleared

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

FieldCleared returns a boolean indicates if this field was cleared in this mutation.

func (*AccessMutation) Fields

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

Fields returns all fields that were changed during this mutation. Note that, in order to get all numeric fields that were in/decremented, call AddedFields().

func (*AccessMutation) ID

func (m *AccessMutation) ID() (id string, exists bool)

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

func (*AccessMutation) OldCreatedAt

func (m *AccessMutation) OldCreatedAt(ctx context.Context) (v int64, err error)

OldCreatedAt returns the old created_at value of the Access. If the Access 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 database query fails.

func (*AccessMutation) OldCreator

func (m *AccessMutation) OldCreator(ctx context.Context) (v string, err error)

OldCreator returns the old creator value of the Access. If the Access 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 database query fails.

func (*AccessMutation) OldField

func (m *AccessMutation) 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 was failed.

func (*AccessMutation) Op

func (m *AccessMutation) Op() Op

Op returns the operation name.

func (*AccessMutation) OwnerCleared

func (m *AccessMutation) OwnerCleared() bool

OwnerCleared returns if the edge owner was cleared.

func (*AccessMutation) OwnerID

func (m *AccessMutation) OwnerID() (id string, exists bool)

OwnerID returns the owner id in the mutation.

func (*AccessMutation) OwnerIDs

func (m *AccessMutation) OwnerIDs() (ids []string)

OwnerIDs returns the owner ids in the mutation. Note that ids always returns len(ids) <= 1 for unique edges, and you should use OwnerID instead. It exists only for internal usage by the builders.

func (*AccessMutation) RemovedEdges

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

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

func (*AccessMutation) RemovedIDs

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

RemovedIDs returns all ids (to other nodes) that were removed for the given edge name.

func (*AccessMutation) ResetCreatedAt

func (m *AccessMutation) ResetCreatedAt()

ResetCreatedAt reset all changes of the "created_at" field.

func (*AccessMutation) ResetCreator

func (m *AccessMutation) ResetCreator()

ResetCreator reset all changes of the "creator" field.

func (*AccessMutation) ResetEdge

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

ResetEdge resets all changes in the mutation regarding the given edge name. It returns an error if the edge is not defined in the schema.

func (*AccessMutation) ResetField

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

ResetField resets all changes in the mutation regarding the given field name. It returns an error if the field is not defined in the schema.

func (*AccessMutation) ResetOwner

func (m *AccessMutation) ResetOwner()

ResetOwner reset all changes of the "owner" edge.

func (*AccessMutation) SetCreatedAt

func (m *AccessMutation) SetCreatedAt(i int64)

SetCreatedAt sets the created_at field.

func (*AccessMutation) SetCreator

func (m *AccessMutation) SetCreator(s string)

SetCreator sets the creator field.

func (*AccessMutation) SetField

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

SetField sets the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.

func (*AccessMutation) SetID

func (m *AccessMutation) SetID(id string)

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

func (*AccessMutation) SetOwnerID

func (m *AccessMutation) SetOwnerID(id string)

SetOwnerID sets the owner edge to User by id.

func (AccessMutation) Tx

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

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

func (*AccessMutation) Type

func (m *AccessMutation) Type() string

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

type AccessQuery

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

AccessQuery is the builder for querying Access entities.

func (*AccessQuery) All

func (aq *AccessQuery) All(ctx context.Context) ([]*Access, error)

All executes the query and returns a list of Accesses.

func (*AccessQuery) AllX

func (aq *AccessQuery) AllX(ctx context.Context) []*Access

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

func (*AccessQuery) Clone

func (aq *AccessQuery) Clone() *AccessQuery

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

func (*AccessQuery) Count

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

Count returns the count of the given query.

func (*AccessQuery) CountX

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

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

func (*AccessQuery) Exist

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

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

func (*AccessQuery) ExistX

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

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

func (*AccessQuery) First

func (aq *AccessQuery) First(ctx context.Context) (*Access, error)

First returns the first Access entity in the query. Returns *NotFoundError when no access was found.

func (*AccessQuery) FirstID

func (aq *AccessQuery) FirstID(ctx context.Context) (id string, err error)

FirstID returns the first Access id in the query. Returns *NotFoundError when no id was found.

func (*AccessQuery) FirstX

func (aq *AccessQuery) FirstX(ctx context.Context) *Access

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

func (*AccessQuery) FirstXID

func (aq *AccessQuery) FirstXID(ctx context.Context) string

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

func (*AccessQuery) GroupBy

func (aq *AccessQuery) GroupBy(field string, fields ...string) *AccessGroupBy

GroupBy 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 {
	CreatedBy string `json:"creator,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Access.Query().
	GroupBy(access.FieldCreator).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*AccessQuery) IDs

func (aq *AccessQuery) IDs(ctx context.Context) ([]string, error)

IDs executes the query and returns a list of Access ids.

func (*AccessQuery) IDsX

func (aq *AccessQuery) IDsX(ctx context.Context) []string

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

func (*AccessQuery) Limit

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

Limit adds a limit step to the query.

func (*AccessQuery) Offset

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

Offset adds an offset step to the query.

func (*AccessQuery) Only

func (aq *AccessQuery) Only(ctx context.Context) (*Access, error)

Only returns the only Access entity in the query, returns an error if not exactly one entity was returned.

func (*AccessQuery) OnlyID

func (aq *AccessQuery) OnlyID(ctx context.Context) (id string, err error)

OnlyID returns the only Access id in the query, returns an error if not exactly one id was returned.

func (*AccessQuery) OnlyIDX

func (aq *AccessQuery) OnlyIDX(ctx context.Context) string

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

func (*AccessQuery) OnlyX

func (aq *AccessQuery) OnlyX(ctx context.Context) *Access

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

func (*AccessQuery) Order

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

Order adds an order step to the query.

func (*AccessQuery) QueryOwner

func (aq *AccessQuery) QueryOwner() *UserQuery

QueryOwner chains the current query on the owner edge.

func (*AccessQuery) Select

func (aq *AccessQuery) Select(field string, fields ...string) *AccessSelect

Select one or more fields from the given query.

Example:

var v []struct {
	CreatedBy string `json:"creator,omitempty"`
}

client.Access.Query().
	Select(access.FieldCreator).
	Scan(ctx, &v)

func (*AccessQuery) Where

func (aq *AccessQuery) Where(ps ...predicate.Access) *AccessQuery

Where adds a new predicate for the builder.

func (*AccessQuery) WithOwner

func (aq *AccessQuery) WithOwner(opts ...func(*UserQuery)) *AccessQuery
WithOwner tells the query-builder to eager-loads the nodes that are connected to

the "owner" edge. The optional arguments used to configure the query builder of the edge.

type AccessSelect

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

AccessSelect is the builder for select fields of Access entities.

func (*AccessSelect) Bool

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

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

func (*AccessSelect) BoolX

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

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

func (*AccessSelect) Bools

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

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

func (*AccessSelect) BoolsX

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

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

func (*AccessSelect) Float64

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

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

func (*AccessSelect) Float64X

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

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

func (*AccessSelect) Float64s

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

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

func (*AccessSelect) Float64sX

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

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

func (*AccessSelect) Int

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

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

func (*AccessSelect) IntX

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

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

func (*AccessSelect) Ints

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

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

func (*AccessSelect) IntsX

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

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

func (*AccessSelect) Scan

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

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

func (*AccessSelect) ScanX

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

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

func (*AccessSelect) String

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

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

func (*AccessSelect) StringX

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

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

func (*AccessSelect) Strings

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

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

func (*AccessSelect) StringsX

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

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

type AccessUpdate

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

AccessUpdate is the builder for updating Access entities.

func (*AccessUpdate) AddCreatedAt

func (au *AccessUpdate) AddCreatedAt(i int64) *AccessUpdate

AddCreatedAt adds i to created_at.

func (*AccessUpdate) ClearOwner

func (au *AccessUpdate) ClearOwner() *AccessUpdate

ClearOwner clears the owner edge to User.

func (*AccessUpdate) Exec

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

Exec executes the query.

func (*AccessUpdate) ExecX

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

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

func (*AccessUpdate) Mutation

func (au *AccessUpdate) Mutation() *AccessMutation

Mutation returns the AccessMutation object of the builder.

func (*AccessUpdate) Save

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

Save executes the query and returns the number of rows/vertices matched by this operation.

func (*AccessUpdate) SaveX

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

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

func (*AccessUpdate) SetCreatedAt

func (au *AccessUpdate) SetCreatedAt(i int64) *AccessUpdate

SetCreatedAt sets the created_at field.

func (*AccessUpdate) SetCreator

func (au *AccessUpdate) SetCreator(s string) *AccessUpdate

SetCreator sets the creator field.

func (*AccessUpdate) SetNillableOwnerID

func (au *AccessUpdate) SetNillableOwnerID(id *string) *AccessUpdate

SetNillableOwnerID sets the owner edge to User by id if the given value is not nil.

func (*AccessUpdate) SetOwner

func (au *AccessUpdate) SetOwner(u *User) *AccessUpdate

SetOwner sets the owner edge to User.

func (*AccessUpdate) SetOwnerID

func (au *AccessUpdate) SetOwnerID(id string) *AccessUpdate

SetOwnerID sets the owner edge to User by id.

func (*AccessUpdate) Where

func (au *AccessUpdate) Where(ps ...predicate.Access) *AccessUpdate

Where adds a new predicate for the builder.

type AccessUpdateOne

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

AccessUpdateOne is the builder for updating a single Access entity.

func (*AccessUpdateOne) AddCreatedAt

func (auo *AccessUpdateOne) AddCreatedAt(i int64) *AccessUpdateOne

AddCreatedAt adds i to created_at.

func (*AccessUpdateOne) ClearOwner

func (auo *AccessUpdateOne) ClearOwner() *AccessUpdateOne

ClearOwner clears the owner edge to User.

func (*AccessUpdateOne) Exec

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

Exec executes the query on the entity.

func (*AccessUpdateOne) ExecX

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

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

func (*AccessUpdateOne) Mutation

func (auo *AccessUpdateOne) Mutation() *AccessMutation

Mutation returns the AccessMutation object of the builder.

func (*AccessUpdateOne) Save

func (auo *AccessUpdateOne) Save(ctx context.Context) (*Access, error)

Save executes the query and returns the updated entity.

func (*AccessUpdateOne) SaveX

func (auo *AccessUpdateOne) SaveX(ctx context.Context) *Access

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

func (*AccessUpdateOne) SetCreatedAt

func (auo *AccessUpdateOne) SetCreatedAt(i int64) *AccessUpdateOne

SetCreatedAt sets the created_at field.

func (*AccessUpdateOne) SetCreator

func (auo *AccessUpdateOne) SetCreator(s string) *AccessUpdateOne

SetCreator sets the creator field.

func (*AccessUpdateOne) SetNillableOwnerID

func (auo *AccessUpdateOne) SetNillableOwnerID(id *string) *AccessUpdateOne

SetNillableOwnerID sets the owner edge to User by id if the given value is not nil.

func (*AccessUpdateOne) SetOwner

func (auo *AccessUpdateOne) SetOwner(u *User) *AccessUpdateOne

SetOwner sets the owner edge to User.

func (*AccessUpdateOne) SetOwnerID

func (auo *AccessUpdateOne) SetOwnerID(id string) *AccessUpdateOne

SetOwnerID sets the owner edge to User by id.

type Accesses

type Accesses []*Access

Accesses is a parsable slice of Access.

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 Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Access is the client for interacting with the Access builders.
	Access *AccessClient
	// Group is the client for interacting with the Group builders.
	Group *GroupClient
	// Permission is the client for interacting with the Permission builders.
	Permission *PermissionClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// contains filtered or unexported fields
}

Client is the client that holds all ent builders.

func FromContext

func FromContext(ctx context.Context) *Client

FromContext returns the Client stored in 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 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().
	Access.
	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 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 Group

type Group struct {

	// ID of the ent.
	ID string `json:"id,omitempty"`
	// Title holds the value of the "title" field.
	Title string `json:"title,omitempty"`
	// Description holds the value of the "description" field.
	Description string `json:"description,omitempty"`
	// CreateAt holds the value of the "create_at" field.
	CreateAt int64 `json:"create_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the GroupQuery when eager-loading is set.
	Edges GroupEdges `json:"edges"`
	// contains filtered or unexported fields
}

Group is the model entity for the Group schema.

func (*Group) QueryUsers

func (gr *Group) QueryUsers() *UserQuery

QueryUsers queries the users edge of the Group.

func (*Group) String

func (gr *Group) String() string

String implements the fmt.Stringer.

func (*Group) Unwrap

func (gr *Group) Unwrap() *Group

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

func (*Group) Update

func (gr *Group) Update() *GroupUpdateOne

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

type GroupClient

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

GroupClient is a client for the Group schema.

func NewGroupClient

func NewGroupClient(c config) *GroupClient

NewGroupClient returns a client for the Group from the given config.

func (*GroupClient) Create

func (c *GroupClient) Create() *GroupCreate

Create returns a create builder for Group.

func (*GroupClient) CreateBulk

func (c *GroupClient) CreateBulk(builders ...*GroupCreate) *GroupCreateBulk

BulkCreate returns a builder for creating a bulk of Group entities.

func (*GroupClient) Delete

func (c *GroupClient) Delete() *GroupDelete

Delete returns a delete builder for Group.

func (*GroupClient) DeleteOne

func (c *GroupClient) DeleteOne(gr *Group) *GroupDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*GroupClient) DeleteOneID

func (c *GroupClient) DeleteOneID(id string) *GroupDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*GroupClient) Get

func (c *GroupClient) Get(ctx context.Context, id string) (*Group, error)

Get returns a Group entity by its id.

func (*GroupClient) GetX

func (c *GroupClient) GetX(ctx context.Context, id string) *Group

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

func (*GroupClient) Hooks

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

Hooks returns the client hooks.

func (*GroupClient) Query

func (c *GroupClient) Query() *GroupQuery

Query returns a query builder for Group.

func (*GroupClient) QueryUsers

func (c *GroupClient) QueryUsers(gr *Group) *UserQuery

QueryUsers queries the users edge of a Group.

func (*GroupClient) Update

func (c *GroupClient) Update() *GroupUpdate

Update returns an update builder for Group.

func (*GroupClient) UpdateOne

func (c *GroupClient) UpdateOne(gr *Group) *GroupUpdateOne

UpdateOne returns an update builder for the given entity.

func (*GroupClient) UpdateOneID

func (c *GroupClient) UpdateOneID(id string) *GroupUpdateOne

UpdateOneID returns an update builder for the given id.

func (*GroupClient) Use

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

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

type GroupCreate

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

GroupCreate is the builder for creating a Group entity.

func (*GroupCreate) AddUserIDs

func (gc *GroupCreate) AddUserIDs(ids ...string) *GroupCreate

AddUserIDs adds the users edge to User by ids.

func (*GroupCreate) AddUsers

func (gc *GroupCreate) AddUsers(u ...*User) *GroupCreate

AddUsers adds the users edges to User.

func (*GroupCreate) Mutation

func (gc *GroupCreate) Mutation() *GroupMutation

Mutation returns the GroupMutation object of the builder.

func (*GroupCreate) Save

func (gc *GroupCreate) Save(ctx context.Context) (*Group, error)

Save creates the Group in the database.

func (*GroupCreate) SaveX

func (gc *GroupCreate) SaveX(ctx context.Context) *Group

SaveX calls Save and panics if Save returns an error.

func (*GroupCreate) SetCreateAt

func (gc *GroupCreate) SetCreateAt(i int64) *GroupCreate

SetCreateAt sets the create_at field.

func (*GroupCreate) SetDescription

func (gc *GroupCreate) SetDescription(s string) *GroupCreate

SetDescription sets the description field.

func (*GroupCreate) SetID

func (gc *GroupCreate) SetID(s string) *GroupCreate

SetID sets the id field.

func (*GroupCreate) SetTitle

func (gc *GroupCreate) SetTitle(s string) *GroupCreate

SetTitle sets the title field.

type GroupCreateBulk

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

GroupCreateBulk is the builder for creating a bulk of Group entities.

func (*GroupCreateBulk) Save

func (gcb *GroupCreateBulk) Save(ctx context.Context) ([]*Group, error)

Save creates the Group entities in the database.

func (*GroupCreateBulk) SaveX

func (gcb *GroupCreateBulk) SaveX(ctx context.Context) []*Group

SaveX calls Save and panics if Save returns an error.

type GroupDelete

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

GroupDelete is the builder for deleting a Group entity.

func (*GroupDelete) Exec

func (gd *GroupDelete) Exec(ctx context.Context) (int, error)

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

func (*GroupDelete) ExecX

func (gd *GroupDelete) ExecX(ctx context.Context) int

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

func (*GroupDelete) Where

func (gd *GroupDelete) Where(ps ...predicate.Group) *GroupDelete

Where adds a new predicate to the delete builder.

type GroupDeleteOne

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

GroupDeleteOne is the builder for deleting a single Group entity.

func (*GroupDeleteOne) Exec

func (gdo *GroupDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*GroupDeleteOne) ExecX

func (gdo *GroupDeleteOne) ExecX(ctx context.Context)

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

type GroupEdges

type GroupEdges struct {
	// Users holds the value of the users edge.
	Users []*User
	// contains filtered or unexported fields
}

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

func (GroupEdges) UsersOrErr

func (e GroupEdges) UsersOrErr() ([]*User, error)

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

type GroupGroupBy

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

GroupGroupBy is the builder for group-by Group entities.

func (*GroupGroupBy) Aggregate

func (ggb *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy

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

func (*GroupGroupBy) Bool

func (ggb *GroupGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*GroupGroupBy) BoolX

func (ggb *GroupGroupBy) BoolX(ctx context.Context) bool

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

func (*GroupGroupBy) Bools

func (ggb *GroupGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*GroupGroupBy) BoolsX

func (ggb *GroupGroupBy) BoolsX(ctx context.Context) []bool

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

func (*GroupGroupBy) Float64

func (ggb *GroupGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*GroupGroupBy) Float64X

func (ggb *GroupGroupBy) Float64X(ctx context.Context) float64

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

func (*GroupGroupBy) Float64s

func (ggb *GroupGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*GroupGroupBy) Float64sX

func (ggb *GroupGroupBy) Float64sX(ctx context.Context) []float64

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

func (*GroupGroupBy) Int

func (ggb *GroupGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*GroupGroupBy) IntX

func (ggb *GroupGroupBy) IntX(ctx context.Context) int

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

func (*GroupGroupBy) Ints

func (ggb *GroupGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*GroupGroupBy) IntsX

func (ggb *GroupGroupBy) IntsX(ctx context.Context) []int

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

func (*GroupGroupBy) Scan

func (ggb *GroupGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*GroupGroupBy) ScanX

func (ggb *GroupGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*GroupGroupBy) String

func (ggb *GroupGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*GroupGroupBy) StringX

func (ggb *GroupGroupBy) StringX(ctx context.Context) string

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

func (*GroupGroupBy) Strings

func (ggb *GroupGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*GroupGroupBy) StringsX

func (ggb *GroupGroupBy) StringsX(ctx context.Context) []string

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

type GroupMutation

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

GroupMutation represents an operation that mutate the Groups nodes in the graph.

func (*GroupMutation) AddCreateAt

func (m *GroupMutation) AddCreateAt(i int64)

AddCreateAt adds i to create_at.

func (*GroupMutation) AddField

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

AddField adds the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.

func (*GroupMutation) AddUserIDs

func (m *GroupMutation) AddUserIDs(ids ...string)

AddUserIDs adds the users edge to User by ids.

func (*GroupMutation) AddedCreateAt

func (m *GroupMutation) AddedCreateAt() (r int64, exists bool)

AddedCreateAt returns the value that was added to the create_at field in this mutation.

func (*GroupMutation) AddedEdges

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

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

func (*GroupMutation) AddedField

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

AddedField returns the numeric value that was in/decremented from a field with the given name. The second value indicates that this field was not set, or was not define in the schema.

func (*GroupMutation) AddedFields

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

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

func (*GroupMutation) AddedIDs

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

AddedIDs returns all ids (to other nodes) that were added for the given edge name.

func (*GroupMutation) ClearEdge

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

ClearEdge clears the value for the given name. It returns an error if the edge name is not defined in the schema.

func (*GroupMutation) ClearField

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

ClearField clears the value for the given name. It returns an error if the field is not defined in the schema.

func (*GroupMutation) ClearedEdges

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

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

func (*GroupMutation) ClearedFields

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

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

func (GroupMutation) Client

func (m GroupMutation) 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 (*GroupMutation) CreateAt

func (m *GroupMutation) CreateAt() (r int64, exists bool)

CreateAt returns the create_at value in the mutation.

func (*GroupMutation) Description

func (m *GroupMutation) Description() (r string, exists bool)

Description returns the description value in the mutation.

func (*GroupMutation) EdgeCleared

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

EdgeCleared returns a boolean indicates if this edge was cleared in this mutation.

func (*GroupMutation) Field

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

Field returns the value of a field with the given name. The second boolean value indicates that this field was not set, or was not define in the schema.

func (*GroupMutation) FieldCleared

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

FieldCleared returns a boolean indicates if this field was cleared in this mutation.

func (*GroupMutation) Fields

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

Fields returns all fields that were changed during this mutation. Note that, in order to get all numeric fields that were in/decremented, call AddedFields().

func (*GroupMutation) ID

func (m *GroupMutation) ID() (id string, exists bool)

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

func (*GroupMutation) OldCreateAt

func (m *GroupMutation) OldCreateAt(ctx context.Context) (v int64, err error)

OldCreateAt returns the old create_at value of the Group. If the Group 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 database query fails.

func (*GroupMutation) OldDescription

func (m *GroupMutation) OldDescription(ctx context.Context) (v string, err error)

OldDescription returns the old description value of the Group. If the Group 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 database query fails.

func (*GroupMutation) OldField

func (m *GroupMutation) 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 was failed.

func (*GroupMutation) OldTitle

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

OldTitle returns the old title value of the Group. If the Group 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 database query fails.

func (*GroupMutation) Op

func (m *GroupMutation) Op() Op

Op returns the operation name.

func (*GroupMutation) RemoveUserIDs

func (m *GroupMutation) RemoveUserIDs(ids ...string)

RemoveUserIDs removes the users edge to User by ids.

func (*GroupMutation) RemovedEdges

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

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

func (*GroupMutation) RemovedIDs

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

RemovedIDs returns all ids (to other nodes) that were removed for the given edge name.

func (*GroupMutation) RemovedUsersIDs

func (m *GroupMutation) RemovedUsersIDs() (ids []string)

RemovedUsers returns the removed ids of users.

func (*GroupMutation) ResetCreateAt

func (m *GroupMutation) ResetCreateAt()

ResetCreateAt reset all changes of the "create_at" field.

func (*GroupMutation) ResetDescription

func (m *GroupMutation) ResetDescription()

ResetDescription reset all changes of the "description" field.

func (*GroupMutation) ResetEdge

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

ResetEdge resets all changes in the mutation regarding the given edge name. It returns an error if the edge is not defined in the schema.

func (*GroupMutation) ResetField

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

ResetField resets all changes in the mutation regarding the given field name. It returns an error if the field is not defined in the schema.

func (*GroupMutation) ResetTitle

func (m *GroupMutation) ResetTitle()

ResetTitle reset all changes of the "title" field.

func (*GroupMutation) ResetUsers

func (m *GroupMutation) ResetUsers()

ResetUsers reset all changes of the "users" edge.

func (*GroupMutation) SetCreateAt

func (m *GroupMutation) SetCreateAt(i int64)

SetCreateAt sets the create_at field.

func (*GroupMutation) SetDescription

func (m *GroupMutation) SetDescription(s string)

SetDescription sets the description field.

func (*GroupMutation) SetField

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

SetField sets the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.

func (*GroupMutation) SetID

func (m *GroupMutation) SetID(id string)

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

func (*GroupMutation) SetTitle

func (m *GroupMutation) SetTitle(s string)

SetTitle sets the title field.

func (*GroupMutation) Title

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

Title returns the title value in the mutation.

func (GroupMutation) Tx

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

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

func (*GroupMutation) Type

func (m *GroupMutation) Type() string

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

func (*GroupMutation) UsersIDs

func (m *GroupMutation) UsersIDs() (ids []string)

UsersIDs returns the users ids in the mutation.

type GroupQuery

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

GroupQuery is the builder for querying Group entities.

func (*GroupQuery) All

func (gq *GroupQuery) All(ctx context.Context) ([]*Group, error)

All executes the query and returns a list of Groups.

func (*GroupQuery) AllX

func (gq *GroupQuery) AllX(ctx context.Context) []*Group

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

func (*GroupQuery) Clone

func (gq *GroupQuery) Clone() *GroupQuery

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

func (*GroupQuery) Count

func (gq *GroupQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*GroupQuery) CountX

func (gq *GroupQuery) CountX(ctx context.Context) int

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

func (*GroupQuery) Exist

func (gq *GroupQuery) Exist(ctx context.Context) (bool, error)

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

func (*GroupQuery) ExistX

func (gq *GroupQuery) ExistX(ctx context.Context) bool

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

func (*GroupQuery) First

func (gq *GroupQuery) First(ctx context.Context) (*Group, error)

First returns the first Group entity in the query. Returns *NotFoundError when no group was found.

func (*GroupQuery) FirstID

func (gq *GroupQuery) FirstID(ctx context.Context) (id string, err error)

FirstID returns the first Group id in the query. Returns *NotFoundError when no id was found.

func (*GroupQuery) FirstX

func (gq *GroupQuery) FirstX(ctx context.Context) *Group

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

func (*GroupQuery) FirstXID

func (gq *GroupQuery) FirstXID(ctx context.Context) string

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

func (*GroupQuery) GroupBy

func (gq *GroupQuery) GroupBy(field string, fields ...string) *GroupGroupBy

GroupBy 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.Group.Query().
	GroupBy(group.FieldTitle).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*GroupQuery) IDs

func (gq *GroupQuery) IDs(ctx context.Context) ([]string, error)

IDs executes the query and returns a list of Group ids.

func (*GroupQuery) IDsX

func (gq *GroupQuery) IDsX(ctx context.Context) []string

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

func (*GroupQuery) Limit

func (gq *GroupQuery) Limit(limit int) *GroupQuery

Limit adds a limit step to the query.

func (*GroupQuery) Offset

func (gq *GroupQuery) Offset(offset int) *GroupQuery

Offset adds an offset step to the query.

func (*GroupQuery) Only

func (gq *GroupQuery) Only(ctx context.Context) (*Group, error)

Only returns the only Group entity in the query, returns an error if not exactly one entity was returned.

func (*GroupQuery) OnlyID

func (gq *GroupQuery) OnlyID(ctx context.Context) (id string, err error)

OnlyID returns the only Group id in the query, returns an error if not exactly one id was returned.

func (*GroupQuery) OnlyIDX

func (gq *GroupQuery) OnlyIDX(ctx context.Context) string

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

func (*GroupQuery) OnlyX

func (gq *GroupQuery) OnlyX(ctx context.Context) *Group

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

func (*GroupQuery) Order

func (gq *GroupQuery) Order(o ...OrderFunc) *GroupQuery

Order adds an order step to the query.

func (*GroupQuery) QueryUsers

func (gq *GroupQuery) QueryUsers() *UserQuery

QueryUsers chains the current query on the users edge.

func (*GroupQuery) Select

func (gq *GroupQuery) Select(field string, fields ...string) *GroupSelect

Select one or more fields from the given query.

Example:

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

client.Group.Query().
	Select(group.FieldTitle).
	Scan(ctx, &v)

func (*GroupQuery) Where

func (gq *GroupQuery) Where(ps ...predicate.Group) *GroupQuery

Where adds a new predicate for the builder.

func (*GroupQuery) WithUsers

func (gq *GroupQuery) WithUsers(opts ...func(*UserQuery)) *GroupQuery
WithUsers tells the query-builder to eager-loads the nodes that are connected to

the "users" edge. The optional arguments used to configure the query builder of the edge.

type GroupSelect

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

GroupSelect is the builder for select fields of Group entities.

func (*GroupSelect) Bool

func (gs *GroupSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*GroupSelect) BoolX

func (gs *GroupSelect) BoolX(ctx context.Context) bool

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

func (*GroupSelect) Bools

func (gs *GroupSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*GroupSelect) BoolsX

func (gs *GroupSelect) BoolsX(ctx context.Context) []bool

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

func (*GroupSelect) Float64

func (gs *GroupSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*GroupSelect) Float64X

func (gs *GroupSelect) Float64X(ctx context.Context) float64

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

func (*GroupSelect) Float64s

func (gs *GroupSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*GroupSelect) Float64sX

func (gs *GroupSelect) Float64sX(ctx context.Context) []float64

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

func (*GroupSelect) Int

func (gs *GroupSelect) Int(ctx context.Context) (_ int, err error)

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

func (*GroupSelect) IntX

func (gs *GroupSelect) IntX(ctx context.Context) int

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

func (*GroupSelect) Ints

func (gs *GroupSelect) Ints(ctx context.Context) ([]int, error)

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

func (*GroupSelect) IntsX

func (gs *GroupSelect) IntsX(ctx context.Context) []int

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

func (*GroupSelect) Scan

func (gs *GroupSelect) Scan(ctx context.Context, v interface{}) error

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

func (*GroupSelect) ScanX

func (gs *GroupSelect) ScanX(ctx context.Context, v interface{})

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

func (*GroupSelect) String

func (gs *GroupSelect) String(ctx context.Context) (_ string, err error)

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

func (*GroupSelect) StringX

func (gs *GroupSelect) StringX(ctx context.Context) string

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

func (*GroupSelect) Strings

func (gs *GroupSelect) Strings(ctx context.Context) ([]string, error)

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

func (*GroupSelect) StringsX

func (gs *GroupSelect) StringsX(ctx context.Context) []string

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

type GroupUpdate

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

GroupUpdate is the builder for updating Group entities.

func (*GroupUpdate) AddCreateAt

func (gu *GroupUpdate) AddCreateAt(i int64) *GroupUpdate

AddCreateAt adds i to create_at.

func (*GroupUpdate) AddUserIDs

func (gu *GroupUpdate) AddUserIDs(ids ...string) *GroupUpdate

AddUserIDs adds the users edge to User by ids.

func (*GroupUpdate) AddUsers

func (gu *GroupUpdate) AddUsers(u ...*User) *GroupUpdate

AddUsers adds the users edges to User.

func (*GroupUpdate) Exec

func (gu *GroupUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*GroupUpdate) ExecX

func (gu *GroupUpdate) ExecX(ctx context.Context)

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

func (*GroupUpdate) Mutation

func (gu *GroupUpdate) Mutation() *GroupMutation

Mutation returns the GroupMutation object of the builder.

func (*GroupUpdate) RemoveUserIDs

func (gu *GroupUpdate) RemoveUserIDs(ids ...string) *GroupUpdate

RemoveUserIDs removes the users edge to User by ids.

func (*GroupUpdate) RemoveUsers

func (gu *GroupUpdate) RemoveUsers(u ...*User) *GroupUpdate

RemoveUsers removes users edges to User.

func (*GroupUpdate) Save

func (gu *GroupUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of rows/vertices matched by this operation.

func (*GroupUpdate) SaveX

func (gu *GroupUpdate) SaveX(ctx context.Context) int

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

func (*GroupUpdate) SetCreateAt

func (gu *GroupUpdate) SetCreateAt(i int64) *GroupUpdate

SetCreateAt sets the create_at field.

func (*GroupUpdate) SetDescription

func (gu *GroupUpdate) SetDescription(s string) *GroupUpdate

SetDescription sets the description field.

func (*GroupUpdate) SetTitle

func (gu *GroupUpdate) SetTitle(s string) *GroupUpdate

SetTitle sets the title field.

func (*GroupUpdate) Where

func (gu *GroupUpdate) Where(ps ...predicate.Group) *GroupUpdate

Where adds a new predicate for the builder.

type GroupUpdateOne

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

GroupUpdateOne is the builder for updating a single Group entity.

func (*GroupUpdateOne) AddCreateAt

func (guo *GroupUpdateOne) AddCreateAt(i int64) *GroupUpdateOne

AddCreateAt adds i to create_at.

func (*GroupUpdateOne) AddUserIDs

func (guo *GroupUpdateOne) AddUserIDs(ids ...string) *GroupUpdateOne

AddUserIDs adds the users edge to User by ids.

func (*GroupUpdateOne) AddUsers

func (guo *GroupUpdateOne) AddUsers(u ...*User) *GroupUpdateOne

AddUsers adds the users edges to User.

func (*GroupUpdateOne) Exec

func (guo *GroupUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*GroupUpdateOne) ExecX

func (guo *GroupUpdateOne) ExecX(ctx context.Context)

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

func (*GroupUpdateOne) Mutation

func (guo *GroupUpdateOne) Mutation() *GroupMutation

Mutation returns the GroupMutation object of the builder.

func (*GroupUpdateOne) RemoveUserIDs

func (guo *GroupUpdateOne) RemoveUserIDs(ids ...string) *GroupUpdateOne

RemoveUserIDs removes the users edge to User by ids.

func (*GroupUpdateOne) RemoveUsers

func (guo *GroupUpdateOne) RemoveUsers(u ...*User) *GroupUpdateOne

RemoveUsers removes users edges to User.

func (*GroupUpdateOne) Save

func (guo *GroupUpdateOne) Save(ctx context.Context) (*Group, error)

Save executes the query and returns the updated entity.

func (*GroupUpdateOne) SaveX

func (guo *GroupUpdateOne) SaveX(ctx context.Context) *Group

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

func (*GroupUpdateOne) SetCreateAt

func (guo *GroupUpdateOne) SetCreateAt(i int64) *GroupUpdateOne

SetCreateAt sets the create_at field.

func (*GroupUpdateOne) SetDescription

func (guo *GroupUpdateOne) SetDescription(s string) *GroupUpdateOne

SetDescription sets the description field.

func (*GroupUpdateOne) SetTitle

func (guo *GroupUpdateOne) SetTitle(s string) *GroupUpdateOne

SetTitle sets the title field.

type Groups

type Groups []*Group

Groups is a parsable slice of Group.

type Hook

type Hook = ent.Hook

ent aliases to avoid import conflict in user's code.

type MutateFunc

type MutateFunc = ent.MutateFunc

ent aliases to avoid import conflict in user's code.

type Mutation

type Mutation = ent.Mutation

ent aliases to avoid import conflict in user's code.

type Mutator

type Mutator = ent.Mutator

ent aliases to avoid import conflict 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 conflict 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 either graph traversal or 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 Permission

type Permission struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// User holds the value of the "user" field.
	User string `json:"user,omitempty"`
	// Data holds the value of the "data" field.
	Data string `json:"data,omitempty"`
	// ActionRead holds the value of the "action_read" field.
	ActionRead bool `json:"action_read,omitempty"`
	// ActionWrite holds the value of the "action_write" field.
	ActionWrite bool `json:"action_write,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the PermissionQuery when eager-loading is set.
	Edges PermissionEdges `json:"edges"`
	// contains filtered or unexported fields
}

Permission is the model entity for the Permission schema.

func (*Permission) QuerySubject

func (pe *Permission) QuerySubject() *UserQuery

QuerySubject queries the subject edge of the Permission.

func (*Permission) String

func (pe *Permission) String() string

String implements the fmt.Stringer.

func (*Permission) Unwrap

func (pe *Permission) Unwrap() *Permission

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

func (*Permission) Update

func (pe *Permission) Update() *PermissionUpdateOne

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

type PermissionClient

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

PermissionClient is a client for the Permission schema.

func NewPermissionClient

func NewPermissionClient(c config) *PermissionClient

NewPermissionClient returns a client for the Permission from the given config.

func (*PermissionClient) Create

func (c *PermissionClient) Create() *PermissionCreate

Create returns a create builder for Permission.

func (*PermissionClient) CreateBulk

func (c *PermissionClient) CreateBulk(builders ...*PermissionCreate) *PermissionCreateBulk

BulkCreate returns a builder for creating a bulk of Permission entities.

func (*PermissionClient) Delete

func (c *PermissionClient) Delete() *PermissionDelete

Delete returns a delete builder for Permission.

func (*PermissionClient) DeleteOne

func (c *PermissionClient) DeleteOne(pe *Permission) *PermissionDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*PermissionClient) DeleteOneID

func (c *PermissionClient) DeleteOneID(id uuid.UUID) *PermissionDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*PermissionClient) Get

Get returns a Permission entity by its id.

func (*PermissionClient) GetX

func (c *PermissionClient) GetX(ctx context.Context, id uuid.UUID) *Permission

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

func (*PermissionClient) Hooks

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

Hooks returns the client hooks.

func (*PermissionClient) Query

func (c *PermissionClient) Query() *PermissionQuery

Query returns a query builder for Permission.

func (*PermissionClient) QuerySubject

func (c *PermissionClient) QuerySubject(pe *Permission) *UserQuery

QuerySubject queries the subject edge of a Permission.

func (*PermissionClient) Update

func (c *PermissionClient) Update() *PermissionUpdate

Update returns an update builder for Permission.

func (*PermissionClient) UpdateOne

func (c *PermissionClient) UpdateOne(pe *Permission) *PermissionUpdateOne

UpdateOne returns an update builder for the given entity.

func (*PermissionClient) UpdateOneID

func (c *PermissionClient) UpdateOneID(id uuid.UUID) *PermissionUpdateOne

UpdateOneID returns an update builder for the given id.

func (*PermissionClient) Use

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

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

type PermissionCreate

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

PermissionCreate is the builder for creating a Permission entity.

func (*PermissionCreate) Mutation

func (pc *PermissionCreate) Mutation() *PermissionMutation

Mutation returns the PermissionMutation object of the builder.

func (*PermissionCreate) Save

func (pc *PermissionCreate) Save(ctx context.Context) (*Permission, error)

Save creates the Permission in the database.

func (*PermissionCreate) SaveX

func (pc *PermissionCreate) SaveX(ctx context.Context) *Permission

SaveX calls Save and panics if Save returns an error.

func (*PermissionCreate) SetActionRead

func (pc *PermissionCreate) SetActionRead(b bool) *PermissionCreate

SetActionRead sets the action_read field.

func (*PermissionCreate) SetActionWrite

func (pc *PermissionCreate) SetActionWrite(b bool) *PermissionCreate

SetActionWrite sets the action_write field.

func (*PermissionCreate) SetData

func (pc *PermissionCreate) SetData(s string) *PermissionCreate

SetData sets the data field.

func (*PermissionCreate) SetID

SetID sets the id field.

func (*PermissionCreate) SetNillableSubjectID

func (pc *PermissionCreate) SetNillableSubjectID(id *string) *PermissionCreate

SetNillableSubjectID sets the subject edge to User by id if the given value is not nil.

func (*PermissionCreate) SetSubject

func (pc *PermissionCreate) SetSubject(u *User) *PermissionCreate

SetSubject sets the subject edge to User.

func (*PermissionCreate) SetSubjectID

func (pc *PermissionCreate) SetSubjectID(id string) *PermissionCreate

SetSubjectID sets the subject edge to User by id.

func (*PermissionCreate) SetUser

func (pc *PermissionCreate) SetUser(s string) *PermissionCreate

SetUser sets the user field.

type PermissionCreateBulk

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

PermissionCreateBulk is the builder for creating a bulk of Permission entities.

func (*PermissionCreateBulk) Save

func (pcb *PermissionCreateBulk) Save(ctx context.Context) ([]*Permission, error)

Save creates the Permission entities in the database.

func (*PermissionCreateBulk) SaveX

func (pcb *PermissionCreateBulk) SaveX(ctx context.Context) []*Permission

SaveX calls Save and panics if Save returns an error.

type PermissionDelete

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

PermissionDelete is the builder for deleting a Permission entity.

func (*PermissionDelete) Exec

func (pd *PermissionDelete) Exec(ctx context.Context) (int, error)

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

func (*PermissionDelete) ExecX

func (pd *PermissionDelete) ExecX(ctx context.Context) int

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

func (*PermissionDelete) Where

Where adds a new predicate to the delete builder.

type PermissionDeleteOne

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

PermissionDeleteOne is the builder for deleting a single Permission entity.

func (*PermissionDeleteOne) Exec

func (pdo *PermissionDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*PermissionDeleteOne) ExecX

func (pdo *PermissionDeleteOne) ExecX(ctx context.Context)

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

type PermissionEdges

type PermissionEdges struct {
	// Subject holds the value of the subject edge.
	Subject *User
	// contains filtered or unexported fields
}

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

func (PermissionEdges) SubjectOrErr

func (e PermissionEdges) SubjectOrErr() (*User, error)

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

type PermissionGroupBy

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

PermissionGroupBy is the builder for group-by Permission entities.

func (*PermissionGroupBy) Aggregate

func (pgb *PermissionGroupBy) Aggregate(fns ...AggregateFunc) *PermissionGroupBy

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

func (*PermissionGroupBy) Bool

func (pgb *PermissionGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*PermissionGroupBy) BoolX

func (pgb *PermissionGroupBy) BoolX(ctx context.Context) bool

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

func (*PermissionGroupBy) Bools

func (pgb *PermissionGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*PermissionGroupBy) BoolsX

func (pgb *PermissionGroupBy) BoolsX(ctx context.Context) []bool

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

func (*PermissionGroupBy) Float64

func (pgb *PermissionGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*PermissionGroupBy) Float64X

func (pgb *PermissionGroupBy) Float64X(ctx context.Context) float64

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

func (*PermissionGroupBy) Float64s

func (pgb *PermissionGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*PermissionGroupBy) Float64sX

func (pgb *PermissionGroupBy) Float64sX(ctx context.Context) []float64

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

func (*PermissionGroupBy) Int

func (pgb *PermissionGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*PermissionGroupBy) IntX

func (pgb *PermissionGroupBy) IntX(ctx context.Context) int

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

func (*PermissionGroupBy) Ints

func (pgb *PermissionGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*PermissionGroupBy) IntsX

func (pgb *PermissionGroupBy) IntsX(ctx context.Context) []int

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

func (*PermissionGroupBy) Scan

func (pgb *PermissionGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*PermissionGroupBy) ScanX

func (pgb *PermissionGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*PermissionGroupBy) String

func (pgb *PermissionGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*PermissionGroupBy) StringX

func (pgb *PermissionGroupBy) StringX(ctx context.Context) string

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

func (*PermissionGroupBy) Strings

func (pgb *PermissionGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*PermissionGroupBy) StringsX

func (pgb *PermissionGroupBy) StringsX(ctx context.Context) []string

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

type PermissionMutation

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

PermissionMutation represents an operation that mutate the Permissions nodes in the graph.

func (*PermissionMutation) ActionRead

func (m *PermissionMutation) ActionRead() (r bool, exists bool)

ActionRead returns the action_read value in the mutation.

func (*PermissionMutation) ActionWrite

func (m *PermissionMutation) ActionWrite() (r bool, exists bool)

ActionWrite returns the action_write value in the mutation.

func (*PermissionMutation) AddField

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

AddField adds the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.

func (*PermissionMutation) AddedEdges

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

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

func (*PermissionMutation) AddedField

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

AddedField returns the numeric value that was in/decremented from a field with the given name. The second value indicates that this field was not set, or was not define in the schema.

func (*PermissionMutation) AddedFields

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

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

func (*PermissionMutation) AddedIDs

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

AddedIDs returns all ids (to other nodes) that were added for the given edge name.

func (*PermissionMutation) ClearEdge

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

ClearEdge clears the value for the given name. It returns an error if the edge name is not defined in the schema.

func (*PermissionMutation) ClearField

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

ClearField clears the value for the given name. It returns an error if the field is not defined in the schema.

func (*PermissionMutation) ClearSubject

func (m *PermissionMutation) ClearSubject()

ClearSubject clears the subject edge to User.

func (*PermissionMutation) ClearedEdges

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

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

func (*PermissionMutation) ClearedFields

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

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

func (PermissionMutation) Client

func (m PermissionMutation) 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 (*PermissionMutation) Data

func (m *PermissionMutation) Data() (r string, exists bool)

Data returns the data value in the mutation.

func (*PermissionMutation) EdgeCleared

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

EdgeCleared returns a boolean indicates if this edge was cleared in this mutation.

func (*PermissionMutation) Field

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

Field returns the value of a field with the given name. The second boolean value indicates that this field was not set, or was not define in the schema.

func (*PermissionMutation) FieldCleared

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

FieldCleared returns a boolean indicates if this field was cleared in this mutation.

func (*PermissionMutation) Fields

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

Fields returns all fields that were changed during this mutation. Note that, in order to get all numeric fields that were in/decremented, call AddedFields().

func (*PermissionMutation) ID

func (m *PermissionMutation) ID() (id uuid.UUID, exists bool)

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

func (*PermissionMutation) OldActionRead

func (m *PermissionMutation) OldActionRead(ctx context.Context) (v bool, err error)

OldActionRead returns the old action_read value of the Permission. If the Permission 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 database query fails.

func (*PermissionMutation) OldActionWrite

func (m *PermissionMutation) OldActionWrite(ctx context.Context) (v bool, err error)

OldActionWrite returns the old action_write value of the Permission. If the Permission 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 database query fails.

func (*PermissionMutation) OldData

func (m *PermissionMutation) OldData(ctx context.Context) (v string, err error)

OldData returns the old data value of the Permission. If the Permission 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 database query fails.

func (*PermissionMutation) OldField

func (m *PermissionMutation) 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 was failed.

func (*PermissionMutation) OldUser

func (m *PermissionMutation) OldUser(ctx context.Context) (v string, err error)

OldUser returns the old user value of the Permission. If the Permission 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 database query fails.

func (*PermissionMutation) Op

func (m *PermissionMutation) Op() Op

Op returns the operation name.

func (*PermissionMutation) RemovedEdges

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

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

func (*PermissionMutation) RemovedIDs

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

RemovedIDs returns all ids (to other nodes) that were removed for the given edge name.

func (*PermissionMutation) ResetActionRead

func (m *PermissionMutation) ResetActionRead()

ResetActionRead reset all changes of the "action_read" field.

func (*PermissionMutation) ResetActionWrite

func (m *PermissionMutation) ResetActionWrite()

ResetActionWrite reset all changes of the "action_write" field.

func (*PermissionMutation) ResetData

func (m *PermissionMutation) ResetData()

ResetData reset all changes of the "data" field.

func (*PermissionMutation) ResetEdge

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

ResetEdge resets all changes in the mutation regarding the given edge name. It returns an error if the edge is not defined in the schema.

func (*PermissionMutation) ResetField

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

ResetField resets all changes in the mutation regarding the given field name. It returns an error if the field is not defined in the schema.

func (*PermissionMutation) ResetSubject

func (m *PermissionMutation) ResetSubject()

ResetSubject reset all changes of the "subject" edge.

func (*PermissionMutation) ResetUser

func (m *PermissionMutation) ResetUser()

ResetUser reset all changes of the "user" field.

func (*PermissionMutation) SetActionRead

func (m *PermissionMutation) SetActionRead(b bool)

SetActionRead sets the action_read field.

func (*PermissionMutation) SetActionWrite

func (m *PermissionMutation) SetActionWrite(b bool)

SetActionWrite sets the action_write field.

func (*PermissionMutation) SetData

func (m *PermissionMutation) SetData(s string)

SetData sets the data field.

func (*PermissionMutation) SetField

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

SetField sets the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.

func (*PermissionMutation) SetID

func (m *PermissionMutation) SetID(id uuid.UUID)

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

func (*PermissionMutation) SetSubjectID

func (m *PermissionMutation) SetSubjectID(id string)

SetSubjectID sets the subject edge to User by id.

func (*PermissionMutation) SetUser

func (m *PermissionMutation) SetUser(s string)

SetUser sets the user field.

func (*PermissionMutation) SubjectCleared

func (m *PermissionMutation) SubjectCleared() bool

SubjectCleared returns if the edge subject was cleared.

func (*PermissionMutation) SubjectID

func (m *PermissionMutation) SubjectID() (id string, exists bool)

SubjectID returns the subject id in the mutation.

func (*PermissionMutation) SubjectIDs

func (m *PermissionMutation) SubjectIDs() (ids []string)

SubjectIDs returns the subject ids in the mutation. Note that ids always returns len(ids) <= 1 for unique edges, and you should use SubjectID instead. It exists only for internal usage by the builders.

func (PermissionMutation) Tx

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

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

func (*PermissionMutation) Type

func (m *PermissionMutation) Type() string

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

func (*PermissionMutation) User

func (m *PermissionMutation) User() (r string, exists bool)

User returns the user value in the mutation.

type PermissionQuery

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

PermissionQuery is the builder for querying Permission entities.

func (*PermissionQuery) All

func (pq *PermissionQuery) All(ctx context.Context) ([]*Permission, error)

All executes the query and returns a list of Permissions.

func (*PermissionQuery) AllX

func (pq *PermissionQuery) AllX(ctx context.Context) []*Permission

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

func (*PermissionQuery) Clone

func (pq *PermissionQuery) Clone() *PermissionQuery

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

func (*PermissionQuery) Count

func (pq *PermissionQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*PermissionQuery) CountX

func (pq *PermissionQuery) CountX(ctx context.Context) int

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

func (*PermissionQuery) Exist

func (pq *PermissionQuery) Exist(ctx context.Context) (bool, error)

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

func (*PermissionQuery) ExistX

func (pq *PermissionQuery) ExistX(ctx context.Context) bool

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

func (*PermissionQuery) First

func (pq *PermissionQuery) First(ctx context.Context) (*Permission, error)

First returns the first Permission entity in the query. Returns *NotFoundError when no permission was found.

func (*PermissionQuery) FirstID

func (pq *PermissionQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

FirstID returns the first Permission id in the query. Returns *NotFoundError when no id was found.

func (*PermissionQuery) FirstX

func (pq *PermissionQuery) FirstX(ctx context.Context) *Permission

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

func (*PermissionQuery) FirstXID

func (pq *PermissionQuery) FirstXID(ctx context.Context) uuid.UUID

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

func (*PermissionQuery) GroupBy

func (pq *PermissionQuery) GroupBy(field string, fields ...string) *PermissionGroupBy

GroupBy 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 {
	User string `json:"user,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Permission.Query().
	GroupBy(permission.FieldUser).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*PermissionQuery) IDs

func (pq *PermissionQuery) IDs(ctx context.Context) ([]uuid.UUID, error)

IDs executes the query and returns a list of Permission ids.

func (*PermissionQuery) IDsX

func (pq *PermissionQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*PermissionQuery) Limit

func (pq *PermissionQuery) Limit(limit int) *PermissionQuery

Limit adds a limit step to the query.

func (*PermissionQuery) Offset

func (pq *PermissionQuery) Offset(offset int) *PermissionQuery

Offset adds an offset step to the query.

func (*PermissionQuery) Only

func (pq *PermissionQuery) Only(ctx context.Context) (*Permission, error)

Only returns the only Permission entity in the query, returns an error if not exactly one entity was returned.

func (*PermissionQuery) OnlyID

func (pq *PermissionQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

OnlyID returns the only Permission id in the query, returns an error if not exactly one id was returned.

func (*PermissionQuery) OnlyIDX

func (pq *PermissionQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*PermissionQuery) OnlyX

func (pq *PermissionQuery) OnlyX(ctx context.Context) *Permission

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

func (*PermissionQuery) Order

func (pq *PermissionQuery) Order(o ...OrderFunc) *PermissionQuery

Order adds an order step to the query.

func (*PermissionQuery) QuerySubject

func (pq *PermissionQuery) QuerySubject() *UserQuery

QuerySubject chains the current query on the subject edge.

func (*PermissionQuery) Select

func (pq *PermissionQuery) Select(field string, fields ...string) *PermissionSelect

Select one or more fields from the given query.

Example:

var v []struct {
	User string `json:"user,omitempty"`
}

client.Permission.Query().
	Select(permission.FieldUser).
	Scan(ctx, &v)

func (*PermissionQuery) Where

Where adds a new predicate for the builder.

func (*PermissionQuery) WithSubject

func (pq *PermissionQuery) WithSubject(opts ...func(*UserQuery)) *PermissionQuery
WithSubject tells the query-builder to eager-loads the nodes that are connected to

the "subject" edge. The optional arguments used to configure the query builder of the edge.

type PermissionSelect

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

PermissionSelect is the builder for select fields of Permission entities.

func (*PermissionSelect) Bool

func (ps *PermissionSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*PermissionSelect) BoolX

func (ps *PermissionSelect) BoolX(ctx context.Context) bool

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

func (*PermissionSelect) Bools

func (ps *PermissionSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*PermissionSelect) BoolsX

func (ps *PermissionSelect) BoolsX(ctx context.Context) []bool

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

func (*PermissionSelect) Float64

func (ps *PermissionSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*PermissionSelect) Float64X

func (ps *PermissionSelect) Float64X(ctx context.Context) float64

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

func (*PermissionSelect) Float64s

func (ps *PermissionSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*PermissionSelect) Float64sX

func (ps *PermissionSelect) Float64sX(ctx context.Context) []float64

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

func (*PermissionSelect) Int

func (ps *PermissionSelect) Int(ctx context.Context) (_ int, err error)

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

func (*PermissionSelect) IntX

func (ps *PermissionSelect) IntX(ctx context.Context) int

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

func (*PermissionSelect) Ints

func (ps *PermissionSelect) Ints(ctx context.Context) ([]int, error)

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

func (*PermissionSelect) IntsX

func (ps *PermissionSelect) IntsX(ctx context.Context) []int

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

func (*PermissionSelect) Scan

func (ps *PermissionSelect) Scan(ctx context.Context, v interface{}) error

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

func (*PermissionSelect) ScanX

func (ps *PermissionSelect) ScanX(ctx context.Context, v interface{})

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

func (*PermissionSelect) String

func (ps *PermissionSelect) String(ctx context.Context) (_ string, err error)

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

func (*PermissionSelect) StringX

func (ps *PermissionSelect) StringX(ctx context.Context) string

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

func (*PermissionSelect) Strings

func (ps *PermissionSelect) Strings(ctx context.Context) ([]string, error)

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

func (*PermissionSelect) StringsX

func (ps *PermissionSelect) StringsX(ctx context.Context) []string

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

type PermissionUpdate

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

PermissionUpdate is the builder for updating Permission entities.

func (*PermissionUpdate) ClearSubject

func (pu *PermissionUpdate) ClearSubject() *PermissionUpdate

ClearSubject clears the subject edge to User.

func (*PermissionUpdate) Exec

func (pu *PermissionUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*PermissionUpdate) ExecX

func (pu *PermissionUpdate) ExecX(ctx context.Context)

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

func (*PermissionUpdate) Mutation

func (pu *PermissionUpdate) Mutation() *PermissionMutation

Mutation returns the PermissionMutation object of the builder.

func (*PermissionUpdate) Save

func (pu *PermissionUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of rows/vertices matched by this operation.

func (*PermissionUpdate) SaveX

func (pu *PermissionUpdate) SaveX(ctx context.Context) int

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

func (*PermissionUpdate) SetActionRead

func (pu *PermissionUpdate) SetActionRead(b bool) *PermissionUpdate

SetActionRead sets the action_read field.

func (*PermissionUpdate) SetActionWrite

func (pu *PermissionUpdate) SetActionWrite(b bool) *PermissionUpdate

SetActionWrite sets the action_write field.

func (*PermissionUpdate) SetData

func (pu *PermissionUpdate) SetData(s string) *PermissionUpdate

SetData sets the data field.

func (*PermissionUpdate) SetNillableSubjectID

func (pu *PermissionUpdate) SetNillableSubjectID(id *string) *PermissionUpdate

SetNillableSubjectID sets the subject edge to User by id if the given value is not nil.

func (*PermissionUpdate) SetSubject

func (pu *PermissionUpdate) SetSubject(u *User) *PermissionUpdate

SetSubject sets the subject edge to User.

func (*PermissionUpdate) SetSubjectID

func (pu *PermissionUpdate) SetSubjectID(id string) *PermissionUpdate

SetSubjectID sets the subject edge to User by id.

func (*PermissionUpdate) SetUser

func (pu *PermissionUpdate) SetUser(s string) *PermissionUpdate

SetUser sets the user field.

func (*PermissionUpdate) Where

Where adds a new predicate for the builder.

type PermissionUpdateOne

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

PermissionUpdateOne is the builder for updating a single Permission entity.

func (*PermissionUpdateOne) ClearSubject

func (puo *PermissionUpdateOne) ClearSubject() *PermissionUpdateOne

ClearSubject clears the subject edge to User.

func (*PermissionUpdateOne) Exec

func (puo *PermissionUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*PermissionUpdateOne) ExecX

func (puo *PermissionUpdateOne) ExecX(ctx context.Context)

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

func (*PermissionUpdateOne) Mutation

func (puo *PermissionUpdateOne) Mutation() *PermissionMutation

Mutation returns the PermissionMutation object of the builder.

func (*PermissionUpdateOne) Save

func (puo *PermissionUpdateOne) Save(ctx context.Context) (*Permission, error)

Save executes the query and returns the updated entity.

func (*PermissionUpdateOne) SaveX

func (puo *PermissionUpdateOne) SaveX(ctx context.Context) *Permission

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

func (*PermissionUpdateOne) SetActionRead

func (puo *PermissionUpdateOne) SetActionRead(b bool) *PermissionUpdateOne

SetActionRead sets the action_read field.

func (*PermissionUpdateOne) SetActionWrite

func (puo *PermissionUpdateOne) SetActionWrite(b bool) *PermissionUpdateOne

SetActionWrite sets the action_write field.

func (*PermissionUpdateOne) SetData

SetData sets the data field.

func (*PermissionUpdateOne) SetNillableSubjectID

func (puo *PermissionUpdateOne) SetNillableSubjectID(id *string) *PermissionUpdateOne

SetNillableSubjectID sets the subject edge to User by id if the given value is not nil.

func (*PermissionUpdateOne) SetSubject

func (puo *PermissionUpdateOne) SetSubject(u *User) *PermissionUpdateOne

SetSubject sets the subject edge to User.

func (*PermissionUpdateOne) SetSubjectID

func (puo *PermissionUpdateOne) SetSubjectID(id string) *PermissionUpdateOne

SetSubjectID sets the subject edge to User by id.

func (*PermissionUpdateOne) SetUser

SetUser sets the user field.

type Permissions

type Permissions []*Permission

Permissions is a parsable slice of Permission.

type Policy

type Policy = ent.Policy

ent aliases to avoid import conflict in user's code.

type Query

type Query = ent.Query

ent aliases to avoid import conflict 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 Tx

type Tx struct {

	// Access is the client for interacting with the Access builders.
	Access *AccessClient
	// Group is the client for interacting with the Group builders.
	Group *GroupClient
	// Permission is the client for interacting with the Permission builders.
	Permission *PermissionClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// 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 the Tx stored in 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 User

type User struct {

	// ID of the ent.
	ID string `json:"id,omitempty"`
	// Password holds the value of the "password" field.
	Password string `json:"password,omitempty"`
	// Email holds the value of the "email" field.
	Email string `json:"email,omitempty"`
	// Validated holds the value of the "validated" field.
	Validated bool `json:"validated,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt int64 `json:"created_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the UserQuery when eager-loading is set.
	Edges UserEdges `json:"edges"`
	// contains filtered or unexported fields
}

User is the model entity for the User schema.

func (*User) QueryAccesses

func (u *User) QueryAccesses() *AccessQuery

QueryAccesses queries the accesses edge of the User.

func (*User) QueryGroup

func (u *User) QueryGroup() *GroupQuery

QueryGroup queries the group edge of the User.

func (*User) QueryPermissions

func (u *User) QueryPermissions() *PermissionQuery

QueryPermissions queries the permissions edge of the User.

func (*User) String

func (u *User) String() string

String implements the fmt.Stringer.

func (*User) Unwrap

func (u *User) Unwrap() *User

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

func (*User) Update

func (u *User) Update() *UserUpdateOne

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

type UserClient

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

UserClient is a client for the User schema.

func NewUserClient

func NewUserClient(c config) *UserClient

NewUserClient returns a client for the User from the given config.

func (*UserClient) Create

func (c *UserClient) Create() *UserCreate

Create returns a create builder for User.

func (*UserClient) CreateBulk

func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk

BulkCreate returns a builder for creating a bulk of User entities.

func (*UserClient) Delete

func (c *UserClient) Delete() *UserDelete

Delete returns a delete builder for User.

func (*UserClient) DeleteOne

func (c *UserClient) DeleteOne(u *User) *UserDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*UserClient) DeleteOneID

func (c *UserClient) DeleteOneID(id string) *UserDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*UserClient) Get

func (c *UserClient) Get(ctx context.Context, id string) (*User, error)

Get returns a User entity by its id.

func (*UserClient) GetX

func (c *UserClient) GetX(ctx context.Context, id string) *User

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

func (*UserClient) Hooks

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

Hooks returns the client hooks.

func (*UserClient) Query

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) QueryAccesses

func (c *UserClient) QueryAccesses(u *User) *AccessQuery

QueryAccesses queries the accesses edge of a User.

func (*UserClient) QueryGroup

func (c *UserClient) QueryGroup(u *User) *GroupQuery

QueryGroup queries the group edge of a User.

func (*UserClient) QueryPermissions

func (c *UserClient) QueryPermissions(u *User) *PermissionQuery

QueryPermissions queries the permissions edge of a User.

func (*UserClient) Update

func (c *UserClient) Update() *UserUpdate

Update returns an update builder for User.

func (*UserClient) UpdateOne

func (c *UserClient) UpdateOne(u *User) *UserUpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserClient) UpdateOneID

func (c *UserClient) UpdateOneID(id string) *UserUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserClient) Use

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

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

type UserCreate

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

UserCreate is the builder for creating a User entity.

func (*UserCreate) AddAccessIDs

func (uc *UserCreate) AddAccessIDs(ids ...string) *UserCreate

AddAccessIDs adds the accesses edge to Access by ids.

func (*UserCreate) AddAccesses

func (uc *UserCreate) AddAccesses(a ...*Access) *UserCreate

AddAccesses adds the accesses edges to Access.

func (*UserCreate) AddPermissionIDs

func (uc *UserCreate) AddPermissionIDs(ids ...uuid.UUID) *UserCreate

AddPermissionIDs adds the permissions edge to Permission by ids.

func (*UserCreate) AddPermissions

func (uc *UserCreate) AddPermissions(p ...*Permission) *UserCreate

AddPermissions adds the permissions edges to Permission.

func (*UserCreate) Mutation

func (uc *UserCreate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserCreate) Save

func (uc *UserCreate) Save(ctx context.Context) (*User, error)

Save creates the User in the database.

func (*UserCreate) SaveX

func (uc *UserCreate) SaveX(ctx context.Context) *User

SaveX calls Save and panics if Save returns an error.

func (*UserCreate) SetCreatedAt

func (uc *UserCreate) SetCreatedAt(i int64) *UserCreate

SetCreatedAt sets the created_at field.

func (*UserCreate) SetEmail

func (uc *UserCreate) SetEmail(s string) *UserCreate

SetEmail sets the email field.

func (*UserCreate) SetGroup

func (uc *UserCreate) SetGroup(g *Group) *UserCreate

SetGroup sets the group edge to Group.

func (*UserCreate) SetGroupID

func (uc *UserCreate) SetGroupID(id string) *UserCreate

SetGroupID sets the group edge to Group by id.

func (*UserCreate) SetID

func (uc *UserCreate) SetID(s string) *UserCreate

SetID sets the id field.

func (*UserCreate) SetNillableGroupID

func (uc *UserCreate) SetNillableGroupID(id *string) *UserCreate

SetNillableGroupID sets the group edge to Group by id if the given value is not nil.

func (*UserCreate) SetNillableValidated

func (uc *UserCreate) SetNillableValidated(b *bool) *UserCreate

SetNillableValidated sets the validated field if the given value is not nil.

func (*UserCreate) SetPassword

func (uc *UserCreate) SetPassword(s string) *UserCreate

SetPassword sets the password field.

func (*UserCreate) SetValidated

func (uc *UserCreate) SetValidated(b bool) *UserCreate

SetValidated sets the validated field.

type UserCreateBulk

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

UserCreateBulk is the builder for creating a bulk of User entities.

func (*UserCreateBulk) Save

func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error)

Save creates the User entities in the database.

func (*UserCreateBulk) SaveX

func (ucb *UserCreateBulk) SaveX(ctx context.Context) []*User

SaveX calls Save and panics if Save returns an error.

type UserDelete

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

UserDelete is the builder for deleting a User entity.

func (*UserDelete) Exec

func (ud *UserDelete) Exec(ctx context.Context) (int, error)

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

func (*UserDelete) ExecX

func (ud *UserDelete) ExecX(ctx context.Context) int

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

func (*UserDelete) Where

func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete

Where adds a new predicate to the delete builder.

type UserDeleteOne

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

UserDeleteOne is the builder for deleting a single User entity.

func (*UserDeleteOne) Exec

func (udo *UserDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserDeleteOne) ExecX

func (udo *UserDeleteOne) ExecX(ctx context.Context)

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

type UserEdges

type UserEdges struct {
	// Group holds the value of the group edge.
	Group *Group
	// Accesses holds the value of the accesses edge.
	Accesses []*Access
	// Permissions holds the value of the permissions edge.
	Permissions []*Permission
	// contains filtered or unexported fields
}

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

func (UserEdges) AccessesOrErr

func (e UserEdges) AccessesOrErr() ([]*Access, error)

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

func (UserEdges) GroupOrErr

func (e UserEdges) GroupOrErr() (*Group, error)

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

func (UserEdges) PermissionsOrErr

func (e UserEdges) PermissionsOrErr() ([]*Permission, error)

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

type UserGroupBy

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

UserGroupBy is the builder for group-by User entities.

func (*UserGroupBy) Aggregate

func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy

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

func (*UserGroupBy) Bool

func (ugb *UserGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*UserGroupBy) BoolX

func (ugb *UserGroupBy) BoolX(ctx context.Context) bool

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

func (*UserGroupBy) Bools

func (ugb *UserGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*UserGroupBy) BoolsX

func (ugb *UserGroupBy) BoolsX(ctx context.Context) []bool

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

func (*UserGroupBy) Float64

func (ugb *UserGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*UserGroupBy) Float64X

func (ugb *UserGroupBy) Float64X(ctx context.Context) float64

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

func (*UserGroupBy) Float64s

func (ugb *UserGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*UserGroupBy) Float64sX

func (ugb *UserGroupBy) Float64sX(ctx context.Context) []float64

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

func (*UserGroupBy) Int

func (ugb *UserGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*UserGroupBy) IntX

func (ugb *UserGroupBy) IntX(ctx context.Context) int

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

func (*UserGroupBy) Ints

func (ugb *UserGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*UserGroupBy) IntsX

func (ugb *UserGroupBy) IntsX(ctx context.Context) []int

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

func (*UserGroupBy) Scan

func (ugb *UserGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*UserGroupBy) ScanX

func (ugb *UserGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*UserGroupBy) String

func (ugb *UserGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*UserGroupBy) StringX

func (ugb *UserGroupBy) StringX(ctx context.Context) string

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

func (*UserGroupBy) Strings

func (ugb *UserGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*UserGroupBy) StringsX

func (ugb *UserGroupBy) StringsX(ctx context.Context) []string

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

type UserMutation

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

UserMutation represents an operation that mutate the Users nodes in the graph.

func (*UserMutation) AccessesIDs

func (m *UserMutation) AccessesIDs() (ids []string)

AccessesIDs returns the accesses ids in the mutation.

func (*UserMutation) AddAccessIDs

func (m *UserMutation) AddAccessIDs(ids ...string)

AddAccessIDs adds the accesses edge to Access by ids.

func (*UserMutation) AddCreatedAt

func (m *UserMutation) AddCreatedAt(i int64)

AddCreatedAt adds i to created_at.

func (*UserMutation) AddField

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

AddField adds the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.

func (*UserMutation) AddPermissionIDs

func (m *UserMutation) AddPermissionIDs(ids ...uuid.UUID)

AddPermissionIDs adds the permissions edge to Permission by ids.

func (*UserMutation) AddedCreatedAt

func (m *UserMutation) AddedCreatedAt() (r int64, exists bool)

AddedCreatedAt returns the value that was added to the created_at field in this mutation.

func (*UserMutation) AddedEdges

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

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

func (*UserMutation) AddedField

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

AddedField returns the numeric value that was in/decremented from a field with the given name. The second value indicates that this field was not set, or was not define in the schema.

func (*UserMutation) AddedFields

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

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

func (*UserMutation) AddedIDs

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

AddedIDs returns all ids (to other nodes) that were added for the given edge name.

func (*UserMutation) ClearEdge

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

ClearEdge clears the value for the given name. It returns an error if the edge name is not defined in the schema.

func (*UserMutation) ClearField

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

ClearField clears the value for the given name. It returns an error if the field is not defined in the schema.

func (*UserMutation) ClearGroup

func (m *UserMutation) ClearGroup()

ClearGroup clears the group edge to Group.

func (*UserMutation) ClearedEdges

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

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

func (*UserMutation) ClearedFields

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

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

func (UserMutation) Client

func (m UserMutation) 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 (*UserMutation) CreatedAt

func (m *UserMutation) CreatedAt() (r int64, exists bool)

CreatedAt returns the created_at value in the mutation.

func (*UserMutation) EdgeCleared

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

EdgeCleared returns a boolean indicates if this edge was cleared in this mutation.

func (*UserMutation) Email

func (m *UserMutation) Email() (r string, exists bool)

Email returns the email value in the mutation.

func (*UserMutation) Field

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

Field returns the value of a field with the given name. The second boolean value indicates that this field was not set, or was not define in the schema.

func (*UserMutation) FieldCleared

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

FieldCleared returns a boolean indicates if this field was cleared in this mutation.

func (*UserMutation) Fields

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

Fields returns all fields that were changed during this mutation. Note that, in order to get all numeric fields that were in/decremented, call AddedFields().

func (*UserMutation) GroupCleared

func (m *UserMutation) GroupCleared() bool

GroupCleared returns if the edge group was cleared.

func (*UserMutation) GroupID

func (m *UserMutation) GroupID() (id string, exists bool)

GroupID returns the group id in the mutation.

func (*UserMutation) GroupIDs

func (m *UserMutation) GroupIDs() (ids []string)

GroupIDs returns the group ids in the mutation. Note that ids always returns len(ids) <= 1 for unique edges, and you should use GroupID instead. It exists only for internal usage by the builders.

func (*UserMutation) ID

func (m *UserMutation) ID() (id string, exists bool)

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

func (*UserMutation) OldCreatedAt

func (m *UserMutation) OldCreatedAt(ctx context.Context) (v int64, err error)

OldCreatedAt returns the old created_at value of the User. If the User 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 database query fails.

func (*UserMutation) OldEmail

func (m *UserMutation) OldEmail(ctx context.Context) (v string, err error)

OldEmail returns the old email value of the User. If the User 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 database query fails.

func (*UserMutation) OldField

func (m *UserMutation) 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 was failed.

func (*UserMutation) OldPassword

func (m *UserMutation) OldPassword(ctx context.Context) (v string, err error)

OldPassword returns the old password value of the User. If the User 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 database query fails.

func (*UserMutation) OldValidated

func (m *UserMutation) OldValidated(ctx context.Context) (v bool, err error)

OldValidated returns the old validated value of the User. If the User 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 database query fails.

func (*UserMutation) Op

func (m *UserMutation) Op() Op

Op returns the operation name.

func (*UserMutation) Password

func (m *UserMutation) Password() (r string, exists bool)

Password returns the password value in the mutation.

func (*UserMutation) PermissionsIDs

func (m *UserMutation) PermissionsIDs() (ids []uuid.UUID)

PermissionsIDs returns the permissions ids in the mutation.

func (*UserMutation) RemoveAccessIDs

func (m *UserMutation) RemoveAccessIDs(ids ...string)

RemoveAccessIDs removes the accesses edge to Access by ids.

func (*UserMutation) RemovePermissionIDs

func (m *UserMutation) RemovePermissionIDs(ids ...uuid.UUID)

RemovePermissionIDs removes the permissions edge to Permission by ids.

func (*UserMutation) RemovedAccessesIDs

func (m *UserMutation) RemovedAccessesIDs() (ids []string)

RemovedAccesses returns the removed ids of accesses.

func (*UserMutation) RemovedEdges

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

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

func (*UserMutation) RemovedIDs

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

RemovedIDs returns all ids (to other nodes) that were removed for the given edge name.

func (*UserMutation) RemovedPermissionsIDs

func (m *UserMutation) RemovedPermissionsIDs() (ids []uuid.UUID)

RemovedPermissions returns the removed ids of permissions.

func (*UserMutation) ResetAccesses

func (m *UserMutation) ResetAccesses()

ResetAccesses reset all changes of the "accesses" edge.

func (*UserMutation) ResetCreatedAt

func (m *UserMutation) ResetCreatedAt()

ResetCreatedAt reset all changes of the "created_at" field.

func (*UserMutation) ResetEdge

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

ResetEdge resets all changes in the mutation regarding the given edge name. It returns an error if the edge is not defined in the schema.

func (*UserMutation) ResetEmail

func (m *UserMutation) ResetEmail()

ResetEmail reset all changes of the "email" field.

func (*UserMutation) ResetField

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

ResetField resets all changes in the mutation regarding the given field name. It returns an error if the field is not defined in the schema.

func (*UserMutation) ResetGroup

func (m *UserMutation) ResetGroup()

ResetGroup reset all changes of the "group" edge.

func (*UserMutation) ResetPassword

func (m *UserMutation) ResetPassword()

ResetPassword reset all changes of the "password" field.

func (*UserMutation) ResetPermissions

func (m *UserMutation) ResetPermissions()

ResetPermissions reset all changes of the "permissions" edge.

func (*UserMutation) ResetValidated

func (m *UserMutation) ResetValidated()

ResetValidated reset all changes of the "validated" field.

func (*UserMutation) SetCreatedAt

func (m *UserMutation) SetCreatedAt(i int64)

SetCreatedAt sets the created_at field.

func (*UserMutation) SetEmail

func (m *UserMutation) SetEmail(s string)

SetEmail sets the email field.

func (*UserMutation) SetField

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

SetField sets the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.

func (*UserMutation) SetGroupID

func (m *UserMutation) SetGroupID(id string)

SetGroupID sets the group edge to Group by id.

func (*UserMutation) SetID

func (m *UserMutation) SetID(id string)

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

func (*UserMutation) SetPassword

func (m *UserMutation) SetPassword(s string)

SetPassword sets the password field.

func (*UserMutation) SetValidated

func (m *UserMutation) SetValidated(b bool)

SetValidated sets the validated field.

func (UserMutation) Tx

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

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

func (*UserMutation) Type

func (m *UserMutation) Type() string

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

func (*UserMutation) Validated

func (m *UserMutation) Validated() (r bool, exists bool)

Validated returns the validated value in the mutation.

type UserQuery

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

UserQuery is the builder for querying User entities.

func (*UserQuery) All

func (uq *UserQuery) All(ctx context.Context) ([]*User, error)

All executes the query and returns a list of Users.

func (*UserQuery) AllX

func (uq *UserQuery) AllX(ctx context.Context) []*User

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

func (*UserQuery) Clone

func (uq *UserQuery) Clone() *UserQuery

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

func (*UserQuery) Count

func (uq *UserQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserQuery) CountX

func (uq *UserQuery) CountX(ctx context.Context) int

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

func (*UserQuery) Exist

func (uq *UserQuery) Exist(ctx context.Context) (bool, error)

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

func (*UserQuery) ExistX

func (uq *UserQuery) ExistX(ctx context.Context) bool

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

func (*UserQuery) First

func (uq *UserQuery) First(ctx context.Context) (*User, error)

First returns the first User entity in the query. Returns *NotFoundError when no user was found.

func (*UserQuery) FirstID

func (uq *UserQuery) FirstID(ctx context.Context) (id string, err error)

FirstID returns the first User id in the query. Returns *NotFoundError when no id was found.

func (*UserQuery) FirstX

func (uq *UserQuery) FirstX(ctx context.Context) *User

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

func (*UserQuery) FirstXID

func (uq *UserQuery) FirstXID(ctx context.Context) string

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

func (*UserQuery) GroupBy

func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy

GroupBy 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 {
	Password string `json:"password,omitempty"`
	Count int `json:"count,omitempty"`
}

client.User.Query().
	GroupBy(user.FieldPassword).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserQuery) IDs

func (uq *UserQuery) IDs(ctx context.Context) ([]string, error)

IDs executes the query and returns a list of User ids.

func (*UserQuery) IDsX

func (uq *UserQuery) IDsX(ctx context.Context) []string

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

func (*UserQuery) Limit

func (uq *UserQuery) Limit(limit int) *UserQuery

Limit adds a limit step to the query.

func (*UserQuery) Offset

func (uq *UserQuery) Offset(offset int) *UserQuery

Offset adds an offset step to the query.

func (*UserQuery) Only

func (uq *UserQuery) Only(ctx context.Context) (*User, error)

Only returns the only User entity in the query, returns an error if not exactly one entity was returned.

func (*UserQuery) OnlyID

func (uq *UserQuery) OnlyID(ctx context.Context) (id string, err error)

OnlyID returns the only User id in the query, returns an error if not exactly one id was returned.

func (*UserQuery) OnlyIDX

func (uq *UserQuery) OnlyIDX(ctx context.Context) string

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

func (*UserQuery) OnlyX

func (uq *UserQuery) OnlyX(ctx context.Context) *User

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

func (*UserQuery) Order

func (uq *UserQuery) Order(o ...OrderFunc) *UserQuery

Order adds an order step to the query.

func (*UserQuery) QueryAccesses

func (uq *UserQuery) QueryAccesses() *AccessQuery

QueryAccesses chains the current query on the accesses edge.

func (*UserQuery) QueryGroup

func (uq *UserQuery) QueryGroup() *GroupQuery

QueryGroup chains the current query on the group edge.

func (*UserQuery) QueryPermissions

func (uq *UserQuery) QueryPermissions() *PermissionQuery

QueryPermissions chains the current query on the permissions edge.

func (*UserQuery) Select

func (uq *UserQuery) Select(field string, fields ...string) *UserSelect

Select one or more fields from the given query.

Example:

var v []struct {
	Password string `json:"password,omitempty"`
}

client.User.Query().
	Select(user.FieldPassword).
	Scan(ctx, &v)

func (*UserQuery) Where

func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery

Where adds a new predicate for the builder.

func (*UserQuery) WithAccesses

func (uq *UserQuery) WithAccesses(opts ...func(*AccessQuery)) *UserQuery
WithAccesses tells the query-builder to eager-loads the nodes that are connected to

the "accesses" edge. The optional arguments used to configure the query builder of the edge.

func (*UserQuery) WithGroup

func (uq *UserQuery) WithGroup(opts ...func(*GroupQuery)) *UserQuery
WithGroup tells the query-builder to eager-loads the nodes that are connected to

the "group" edge. The optional arguments used to configure the query builder of the edge.

func (*UserQuery) WithPermissions

func (uq *UserQuery) WithPermissions(opts ...func(*PermissionQuery)) *UserQuery
WithPermissions tells the query-builder to eager-loads the nodes that are connected to

the "permissions" edge. The optional arguments used to configure the query builder of the edge.

type UserSelect

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

UserSelect is the builder for select fields of User entities.

func (*UserSelect) Bool

func (us *UserSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*UserSelect) BoolX

func (us *UserSelect) BoolX(ctx context.Context) bool

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

func (*UserSelect) Bools

func (us *UserSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*UserSelect) BoolsX

func (us *UserSelect) BoolsX(ctx context.Context) []bool

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

func (*UserSelect) Float64

func (us *UserSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*UserSelect) Float64X

func (us *UserSelect) Float64X(ctx context.Context) float64

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

func (*UserSelect) Float64s

func (us *UserSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*UserSelect) Float64sX

func (us *UserSelect) Float64sX(ctx context.Context) []float64

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

func (*UserSelect) Int

func (us *UserSelect) Int(ctx context.Context) (_ int, err error)

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

func (*UserSelect) IntX

func (us *UserSelect) IntX(ctx context.Context) int

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

func (*UserSelect) Ints

func (us *UserSelect) Ints(ctx context.Context) ([]int, error)

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

func (*UserSelect) IntsX

func (us *UserSelect) IntsX(ctx context.Context) []int

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

func (*UserSelect) Scan

func (us *UserSelect) Scan(ctx context.Context, v interface{}) error

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

func (*UserSelect) ScanX

func (us *UserSelect) ScanX(ctx context.Context, v interface{})

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

func (*UserSelect) String

func (us *UserSelect) String(ctx context.Context) (_ string, err error)

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

func (*UserSelect) StringX

func (us *UserSelect) StringX(ctx context.Context) string

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

func (*UserSelect) Strings

func (us *UserSelect) Strings(ctx context.Context) ([]string, error)

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

func (*UserSelect) StringsX

func (us *UserSelect) StringsX(ctx context.Context) []string

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

type UserUpdate

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

UserUpdate is the builder for updating User entities.

func (*UserUpdate) AddAccessIDs

func (uu *UserUpdate) AddAccessIDs(ids ...string) *UserUpdate

AddAccessIDs adds the accesses edge to Access by ids.

func (*UserUpdate) AddAccesses

func (uu *UserUpdate) AddAccesses(a ...*Access) *UserUpdate

AddAccesses adds the accesses edges to Access.

func (*UserUpdate) AddCreatedAt

func (uu *UserUpdate) AddCreatedAt(i int64) *UserUpdate

AddCreatedAt adds i to created_at.

func (*UserUpdate) AddPermissionIDs

func (uu *UserUpdate) AddPermissionIDs(ids ...uuid.UUID) *UserUpdate

AddPermissionIDs adds the permissions edge to Permission by ids.

func (*UserUpdate) AddPermissions

func (uu *UserUpdate) AddPermissions(p ...*Permission) *UserUpdate

AddPermissions adds the permissions edges to Permission.

func (*UserUpdate) ClearGroup

func (uu *UserUpdate) ClearGroup() *UserUpdate

ClearGroup clears the group edge to Group.

func (*UserUpdate) Exec

func (uu *UserUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpdate) ExecX

func (uu *UserUpdate) ExecX(ctx context.Context)

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

func (*UserUpdate) Mutation

func (uu *UserUpdate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdate) RemoveAccessIDs

func (uu *UserUpdate) RemoveAccessIDs(ids ...string) *UserUpdate

RemoveAccessIDs removes the accesses edge to Access by ids.

func (*UserUpdate) RemoveAccesses

func (uu *UserUpdate) RemoveAccesses(a ...*Access) *UserUpdate

RemoveAccesses removes accesses edges to Access.

func (*UserUpdate) RemovePermissionIDs

func (uu *UserUpdate) RemovePermissionIDs(ids ...uuid.UUID) *UserUpdate

RemovePermissionIDs removes the permissions edge to Permission by ids.

func (*UserUpdate) RemovePermissions

func (uu *UserUpdate) RemovePermissions(p ...*Permission) *UserUpdate

RemovePermissions removes permissions edges to Permission.

func (*UserUpdate) Save

func (uu *UserUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of rows/vertices matched by this operation.

func (*UserUpdate) SaveX

func (uu *UserUpdate) SaveX(ctx context.Context) int

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

func (*UserUpdate) SetCreatedAt

func (uu *UserUpdate) SetCreatedAt(i int64) *UserUpdate

SetCreatedAt sets the created_at field.

func (*UserUpdate) SetEmail

func (uu *UserUpdate) SetEmail(s string) *UserUpdate

SetEmail sets the email field.

func (*UserUpdate) SetGroup

func (uu *UserUpdate) SetGroup(g *Group) *UserUpdate

SetGroup sets the group edge to Group.

func (*UserUpdate) SetGroupID

func (uu *UserUpdate) SetGroupID(id string) *UserUpdate

SetGroupID sets the group edge to Group by id.

func (*UserUpdate) SetNillableGroupID

func (uu *UserUpdate) SetNillableGroupID(id *string) *UserUpdate

SetNillableGroupID sets the group edge to Group by id if the given value is not nil.

func (*UserUpdate) SetNillableValidated

func (uu *UserUpdate) SetNillableValidated(b *bool) *UserUpdate

SetNillableValidated sets the validated field if the given value is not nil.

func (*UserUpdate) SetPassword

func (uu *UserUpdate) SetPassword(s string) *UserUpdate

SetPassword sets the password field.

func (*UserUpdate) SetValidated

func (uu *UserUpdate) SetValidated(b bool) *UserUpdate

SetValidated sets the validated field.

func (*UserUpdate) Where

func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate

Where adds a new predicate for the builder.

type UserUpdateOne

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

UserUpdateOne is the builder for updating a single User entity.

func (*UserUpdateOne) AddAccessIDs

func (uuo *UserUpdateOne) AddAccessIDs(ids ...string) *UserUpdateOne

AddAccessIDs adds the accesses edge to Access by ids.

func (*UserUpdateOne) AddAccesses

func (uuo *UserUpdateOne) AddAccesses(a ...*Access) *UserUpdateOne

AddAccesses adds the accesses edges to Access.

func (*UserUpdateOne) AddCreatedAt

func (uuo *UserUpdateOne) AddCreatedAt(i int64) *UserUpdateOne

AddCreatedAt adds i to created_at.

func (*UserUpdateOne) AddPermissionIDs

func (uuo *UserUpdateOne) AddPermissionIDs(ids ...uuid.UUID) *UserUpdateOne

AddPermissionIDs adds the permissions edge to Permission by ids.

func (*UserUpdateOne) AddPermissions

func (uuo *UserUpdateOne) AddPermissions(p ...*Permission) *UserUpdateOne

AddPermissions adds the permissions edges to Permission.

func (*UserUpdateOne) ClearGroup

func (uuo *UserUpdateOne) ClearGroup() *UserUpdateOne

ClearGroup clears the group edge to Group.

func (*UserUpdateOne) Exec

func (uuo *UserUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserUpdateOne) ExecX

func (uuo *UserUpdateOne) ExecX(ctx context.Context)

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

func (*UserUpdateOne) Mutation

func (uuo *UserUpdateOne) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdateOne) RemoveAccessIDs

func (uuo *UserUpdateOne) RemoveAccessIDs(ids ...string) *UserUpdateOne

RemoveAccessIDs removes the accesses edge to Access by ids.

func (*UserUpdateOne) RemoveAccesses

func (uuo *UserUpdateOne) RemoveAccesses(a ...*Access) *UserUpdateOne

RemoveAccesses removes accesses edges to Access.

func (*UserUpdateOne) RemovePermissionIDs

func (uuo *UserUpdateOne) RemovePermissionIDs(ids ...uuid.UUID) *UserUpdateOne

RemovePermissionIDs removes the permissions edge to Permission by ids.

func (*UserUpdateOne) RemovePermissions

func (uuo *UserUpdateOne) RemovePermissions(p ...*Permission) *UserUpdateOne

RemovePermissions removes permissions edges to Permission.

func (*UserUpdateOne) Save

func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)

Save executes the query and returns the updated entity.

func (*UserUpdateOne) SaveX

func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User

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

func (*UserUpdateOne) SetCreatedAt

func (uuo *UserUpdateOne) SetCreatedAt(i int64) *UserUpdateOne

SetCreatedAt sets the created_at field.

func (*UserUpdateOne) SetEmail

func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne

SetEmail sets the email field.

func (*UserUpdateOne) SetGroup

func (uuo *UserUpdateOne) SetGroup(g *Group) *UserUpdateOne

SetGroup sets the group edge to Group.

func (*UserUpdateOne) SetGroupID

func (uuo *UserUpdateOne) SetGroupID(id string) *UserUpdateOne

SetGroupID sets the group edge to Group by id.

func (*UserUpdateOne) SetNillableGroupID

func (uuo *UserUpdateOne) SetNillableGroupID(id *string) *UserUpdateOne

SetNillableGroupID sets the group edge to Group by id if the given value is not nil.

func (*UserUpdateOne) SetNillableValidated

func (uuo *UserUpdateOne) SetNillableValidated(b *bool) *UserUpdateOne

SetNillableValidated sets the validated field if the given value is not nil.

func (*UserUpdateOne) SetPassword

func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne

SetPassword sets the password field.

func (*UserUpdateOne) SetValidated

func (uuo *UserUpdateOne) SetValidated(b bool) *UserUpdateOne

SetValidated sets the validated field.

type Users

type Users []*User

Users is a parsable slice of User.

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 conflict 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