ent: github.com/facebookincubator/ent/entc/integration/ent Index | Examples | Files | Directories

package ent

import "github.com/facebookincubator/ent/entc/integration/ent"

Index

Examples

Package Files

card.go card_create.go card_delete.go card_query.go card_update.go client.go comment.go comment_create.go comment_delete.go comment_query.go comment_update.go config.go context.go ent.go fieldtype.go fieldtype_create.go fieldtype_delete.go fieldtype_query.go fieldtype_update.go file.go file_create.go file_delete.go file_query.go file_update.go filetype.go filetype_create.go filetype_delete.go filetype_query.go filetype_update.go group.go group_create.go group_delete.go group_query.go group_update.go groupinfo.go groupinfo_create.go groupinfo_delete.go groupinfo_query.go groupinfo_update.go item.go item_create.go item_delete.go item_query.go item_update.go node.go node_create.go node_delete.go node_query.go node_update.go pet.go pet_create.go pet_delete.go pet_query.go pet_update.go tx.go user.go user_create.go user_delete.go user_query.go user_update.go

Constants

const DefaultCountLabel = "count"

DefaultCountLabel is the default label name for the Count aggregation function. It should be used as the struct-tag for decoding, or a map key for interaction with the returned response. In order to "count" 2 or more fields and avoid conflicting, use the `ent.As(ent.Count(field), "custom_name")` function with custom name in order to override it.

const DefaultMaxLabel = "max"

DefaultMaxLabel is the default label name for the Max aggregation function. It should be used as the struct-tag for decoding, or a map key for interaction with the returned response. In order to "max" 2 or more fields and avoid conflicting, use the `ent.As(ent.Max(field), "custom_name")` function with custom name in order to override it.

const DefaultMeanLabel = "mean"

DefaultMeanLabel is the default label name for the Mean aggregation function. It should be used as the struct-tag for decoding, or a map key for interaction with the returned response. In order to "mean" 2 or more fields and avoid conflicting, use the `ent.As(ent.Mean(field), "custom_name")` function with custom name in order to override it.

const DefaultMinLabel = "min"

DefaultMinLabel is the default label name for the Min aggregation function. It should be used as the struct-tag for decoding, or a map key for interaction with the returned response. In order to "min" 2 or more fields and avoid conflicting, use the `ent.As(ent.Min(field), "custom_name")` function with custom name in order to override it.

const DefaultSumLabel = "sum"

DefaultSumLabel is the default label name for the Sum aggregation function. It should be used as the struct-tag for decoding, or a map key for interaction with the returned response. In order to "sum" 2 or more fields and avoid conflicting, use the `ent.As(ent.Sum(field), "custom_name")` function with custom name in order to override it.

func IsConstraintFailure Uses

func IsConstraintFailure(err error) bool

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

func IsNotFound Uses

func IsNotFound(err error) bool

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

func IsNotSingular Uses

func IsNotSingular(err error) bool

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

func MaskNotFound Uses

func MaskNotFound(err error) error

MaskNotFound masks nor found error.

func NewContext Uses

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

NewContext returns a new context with the given Client attached.

type Aggregate Uses

type Aggregate struct {
    // SQL the column wrapped with the aggregation function.
    SQL func(*sql.Selector) string
    // Gremlin gets two labels as parameters. The first used in the `As` step for the predicate,
    // and the second is an optional name for the next predicates (or for later usage).
    Gremlin func(string, string) (string, *dsl.Traversal)
}

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

func As Uses

func As(fn Aggregate, end string) Aggregate

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 Uses

func Count() Aggregate

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

func Max Uses

func Max(field string) Aggregate

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

func Mean Uses

func Mean(field string) Aggregate

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

func Min Uses

func Min(field string) Aggregate

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

func Sum Uses

func Sum(field string) Aggregate

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

type Card Uses

type Card struct {

    // ID of the ent.
    ID  string `json:"id,omitempty"`
    // CreateTime holds the value of the "create_time" field.
    CreateTime time.Time `json:"create_time,omitempty"`
    // UpdateTime holds the value of the "update_time" field.
    UpdateTime time.Time `json:"update_time,omitempty"`
    // Number holds the value of the "number" field.
    Number string `json:"number,omitempty"`
    // Name holds the value of the "name" field.
    Name string `json:"name,omitempty"`

    // StaticField defined by templates.
    StaticField string `json:"boring,omitempty"`
    // contains filtered or unexported fields
}

Card is the model entity for the Card schema.

Code:

if dsn == "" {
    return
}
ctx := context.Background()
drv, err := sql.Open("mysql", dsn)
if err != nil {
    log.Fatalf("failed creating database client: %v", err)
}
defer drv.Close()
client := NewClient(Driver(drv))
// creating vertices for the card's edges.

// create card vertex with its edges.
c := client.Card.
    Create().
    SetCreateTime(time.Now()).
    SetUpdateTime(time.Now()).
    SetNumber("string").
    SetName("string").
    SaveX(ctx)
log.Println("card created:", c)

// query edges.

func (*Card) FromResponse Uses

func (c *Card) FromResponse(res *gremlin.Response) error

FromResponse scans the gremlin response data into Card.

func (*Card) FromRows Uses

func (c *Card) FromRows(rows *sql.Rows) error

FromRows scans the sql response data into Card.

func (*Card) QueryOwner Uses

func (c *Card) QueryOwner() *UserQuery

QueryOwner queries the owner edge of the Card.

func (*Card) String Uses

func (c *Card) String() string

String implements the fmt.Stringer.

func (*Card) Unwrap Uses

func (c *Card) Unwrap() *Card

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 (*Card) Update Uses

func (c *Card) Update() *CardUpdateOne

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

type CardClient Uses

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

CardClient is a client for the Card schema.

func NewCardClient Uses

func NewCardClient(c config) *CardClient

NewCardClient returns a client for the Card from the given config.

func (*CardClient) Create Uses

func (c *CardClient) Create() *CardCreate

Create returns a create builder for Card.

func (*CardClient) Delete Uses

func (c *CardClient) Delete() *CardDelete

Delete returns a delete builder for Card.

func (*CardClient) DeleteOne Uses

func (c *CardClient) DeleteOne(ca *Card) *CardDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*CardClient) DeleteOneID Uses

func (c *CardClient) DeleteOneID(id string) *CardDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*CardClient) Get Uses

func (c *CardClient) Get(ctx context.Context, id string) (*Card, error)

Get returns a Card entity by its id.

func (*CardClient) GetX Uses

func (c *CardClient) GetX(ctx context.Context, id string) *Card

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

func (*CardClient) Query Uses

func (c *CardClient) Query() *CardQuery

Create returns a query builder for Card.

func (*CardClient) QueryOwner Uses

func (c *CardClient) QueryOwner(ca *Card) *UserQuery

QueryOwner queries the owner edge of a Card.

func (*CardClient) Update Uses

func (c *CardClient) Update() *CardUpdate

Update returns an update builder for Card.

func (*CardClient) UpdateOne Uses

func (c *CardClient) UpdateOne(ca *Card) *CardUpdateOne

UpdateOne returns an update builder for the given entity.

func (*CardClient) UpdateOneID Uses

func (c *CardClient) UpdateOneID(id string) *CardUpdateOne

UpdateOneID returns an update builder for the given id.

type CardCreate Uses

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

CardCreate is the builder for creating a Card entity.

func (*CardCreate) Save Uses

func (cc *CardCreate) Save(ctx context.Context) (*Card, error)

Save creates the Card in the database.

func (*CardCreate) SaveX Uses

func (cc *CardCreate) SaveX(ctx context.Context) *Card

SaveX calls Save and panics if Save returns an error.

func (*CardCreate) SetCreateTime Uses

func (cc *CardCreate) SetCreateTime(t time.Time) *CardCreate

SetCreateTime sets the create_time field.

func (*CardCreate) SetName Uses

func (cc *CardCreate) SetName(s string) *CardCreate

SetName sets the name field.

func (*CardCreate) SetNillableCreateTime Uses

func (cc *CardCreate) SetNillableCreateTime(t *time.Time) *CardCreate

SetNillableCreateTime sets the create_time field if the given value is not nil.

func (*CardCreate) SetNillableName Uses

func (cc *CardCreate) SetNillableName(s *string) *CardCreate

SetNillableName sets the name field if the given value is not nil.

func (*CardCreate) SetNillableOwnerID Uses

func (cc *CardCreate) SetNillableOwnerID(id *string) *CardCreate

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

func (*CardCreate) SetNillableUpdateTime Uses

func (cc *CardCreate) SetNillableUpdateTime(t *time.Time) *CardCreate

SetNillableUpdateTime sets the update_time field if the given value is not nil.

func (*CardCreate) SetNumber Uses

func (cc *CardCreate) SetNumber(s string) *CardCreate

SetNumber sets the number field.

func (*CardCreate) SetOwner Uses

func (cc *CardCreate) SetOwner(u *User) *CardCreate

SetOwner sets the owner edge to User.

func (*CardCreate) SetOwnerID Uses

func (cc *CardCreate) SetOwnerID(id string) *CardCreate

SetOwnerID sets the owner edge to User by id.

func (*CardCreate) SetUpdateTime Uses

func (cc *CardCreate) SetUpdateTime(t time.Time) *CardCreate

SetUpdateTime sets the update_time field.

type CardDelete Uses

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

CardDelete is the builder for deleting a Card entity.

func (*CardDelete) Exec Uses

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

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

func (*CardDelete) ExecX Uses

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

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

func (*CardDelete) Where Uses

func (cd *CardDelete) Where(ps ...predicate.Card) *CardDelete

Where adds a new predicate to the delete builder.

type CardDeleteOne Uses

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

CardDeleteOne is the builder for deleting a single Card entity.

func (*CardDeleteOne) Exec Uses

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

Exec executes the deletion query.

func (*CardDeleteOne) ExecX Uses

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

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

type CardGroupBy Uses

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

CardGroupBy is the builder for group-by Card entities.

func (*CardGroupBy) Aggregate Uses

func (cgb *CardGroupBy) Aggregate(fns ...Aggregate) *CardGroupBy

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

func (*CardGroupBy) Bools Uses

func (cgb *CardGroupBy) 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 (*CardGroupBy) BoolsX Uses

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

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

func (*CardGroupBy) Float64s Uses

func (cgb *CardGroupBy) 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 (*CardGroupBy) Float64sX Uses

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

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

func (*CardGroupBy) Ints Uses

func (cgb *CardGroupBy) 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 (*CardGroupBy) IntsX Uses

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

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

func (*CardGroupBy) Scan Uses

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

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

func (*CardGroupBy) ScanX Uses

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

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

func (*CardGroupBy) Strings Uses

func (cgb *CardGroupBy) 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 (*CardGroupBy) StringsX Uses

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

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

type CardQuery Uses

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

CardQuery is the builder for querying Card entities.

func (*CardQuery) All Uses

func (cq *CardQuery) All(ctx context.Context) ([]*Card, error)

All executes the query and returns a list of Cards.

func (*CardQuery) AllX Uses

func (cq *CardQuery) AllX(ctx context.Context) []*Card

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

func (*CardQuery) Clone Uses

func (cq *CardQuery) Clone() *CardQuery

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 (*CardQuery) Count Uses

func (cq *CardQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*CardQuery) CountX Uses

func (cq *CardQuery) CountX(ctx context.Context) int

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

func (*CardQuery) Exist Uses

func (cq *CardQuery) Exist(ctx context.Context) (bool, error)

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

func (*CardQuery) ExistX Uses

func (cq *CardQuery) ExistX(ctx context.Context) bool

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

func (*CardQuery) First Uses

func (cq *CardQuery) First(ctx context.Context) (*Card, error)

First returns the first Card entity in the query. Returns *ErrNotFound when no card was found.

func (*CardQuery) FirstID Uses

func (cq *CardQuery) FirstID(ctx context.Context) (id string, err error)

FirstID returns the first Card id in the query. Returns *ErrNotFound when no id was found.

func (*CardQuery) FirstX Uses

func (cq *CardQuery) FirstX(ctx context.Context) *Card

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

func (*CardQuery) FirstXID Uses

func (cq *CardQuery) FirstXID(ctx context.Context) string

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

func (*CardQuery) GroupBy Uses

func (cq *CardQuery) GroupBy(field string, fields ...string) *CardGroupBy

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 {
	CreateTime time.Time `json:"create_time,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Card.Query().
	GroupBy(card.FieldCreateTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*CardQuery) IDs Uses

func (cq *CardQuery) IDs(ctx context.Context) ([]string, error)

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

func (*CardQuery) IDsX Uses

func (cq *CardQuery) IDsX(ctx context.Context) []string

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

func (*CardQuery) Limit Uses

func (cq *CardQuery) Limit(limit int) *CardQuery

Limit adds a limit step to the query.

func (*CardQuery) Offset Uses

func (cq *CardQuery) Offset(offset int) *CardQuery

Offset adds an offset step to the query.

func (*CardQuery) Only Uses

func (cq *CardQuery) Only(ctx context.Context) (*Card, error)

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

func (*CardQuery) OnlyID Uses

func (cq *CardQuery) OnlyID(ctx context.Context) (id string, err error)

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

func (*CardQuery) OnlyX Uses

func (cq *CardQuery) OnlyX(ctx context.Context) *Card

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

func (*CardQuery) OnlyXID Uses

func (cq *CardQuery) OnlyXID(ctx context.Context) string

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

func (*CardQuery) Order Uses

func (cq *CardQuery) Order(o ...Order) *CardQuery

Order adds an order step to the query.

func (*CardQuery) QueryOwner Uses

func (cq *CardQuery) QueryOwner() *UserQuery

QueryOwner chains the current query on the owner edge.

func (*CardQuery) Select Uses

func (cq *CardQuery) Select(field string, fields ...string) *CardSelect

Select one or more fields from the given query.

Example:

var v []struct {
	CreateTime time.Time `json:"create_time,omitempty"`
}

client.Card.Query().
	Select(card.FieldCreateTime).
	Scan(ctx, &v)

func (*CardQuery) Where Uses

func (cq *CardQuery) Where(ps ...predicate.Card) *CardQuery

Where adds a new predicate for the builder.

type CardSelect Uses

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

CardSelect is the builder for select fields of Card entities.

func (*CardSelect) Bools Uses

func (cs *CardSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*CardSelect) BoolsX Uses

func (cs *CardSelect) BoolsX(ctx context.Context) []bool

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

func (*CardSelect) Float64s Uses

func (cs *CardSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*CardSelect) Float64sX Uses

func (cs *CardSelect) Float64sX(ctx context.Context) []float64

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

func (*CardSelect) Ints Uses

func (cs *CardSelect) Ints(ctx context.Context) ([]int, error)

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

func (*CardSelect) IntsX Uses

func (cs *CardSelect) IntsX(ctx context.Context) []int

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

func (*CardSelect) Scan Uses

func (cs *CardSelect) Scan(ctx context.Context, v interface{}) error

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

func (*CardSelect) ScanX Uses

func (cs *CardSelect) ScanX(ctx context.Context, v interface{})

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

func (*CardSelect) Strings Uses

func (cs *CardSelect) Strings(ctx context.Context) ([]string, error)

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

func (*CardSelect) StringsX Uses

func (cs *CardSelect) StringsX(ctx context.Context) []string

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

type CardUpdate Uses

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

CardUpdate is the builder for updating Card entities.

func (*CardUpdate) ClearName Uses

func (cu *CardUpdate) ClearName() *CardUpdate

ClearName clears the value of name.

func (*CardUpdate) ClearOwner Uses

func (cu *CardUpdate) ClearOwner() *CardUpdate

ClearOwner clears the owner edge to User.

func (*CardUpdate) Exec Uses

func (cu *CardUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*CardUpdate) ExecX Uses

func (cu *CardUpdate) ExecX(ctx context.Context)

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

func (*CardUpdate) Save Uses

func (cu *CardUpdate) Save(ctx context.Context) (int, error)

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

func (*CardUpdate) SaveX Uses

func (cu *CardUpdate) SaveX(ctx context.Context) int

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

func (*CardUpdate) SetName Uses

func (cu *CardUpdate) SetName(s string) *CardUpdate

SetName sets the name field.

func (*CardUpdate) SetNillableName Uses

func (cu *CardUpdate) SetNillableName(s *string) *CardUpdate

SetNillableName sets the name field if the given value is not nil.

func (*CardUpdate) SetNillableOwnerID Uses

func (cu *CardUpdate) SetNillableOwnerID(id *string) *CardUpdate

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

func (*CardUpdate) SetOwner Uses

func (cu *CardUpdate) SetOwner(u *User) *CardUpdate

SetOwner sets the owner edge to User.

func (*CardUpdate) SetOwnerID Uses

func (cu *CardUpdate) SetOwnerID(id string) *CardUpdate

SetOwnerID sets the owner edge to User by id.

func (*CardUpdate) Where Uses

func (cu *CardUpdate) Where(ps ...predicate.Card) *CardUpdate

Where adds a new predicate for the builder.

type CardUpdateOne Uses

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

CardUpdateOne is the builder for updating a single Card entity.

func (*CardUpdateOne) ClearName Uses

func (cuo *CardUpdateOne) ClearName() *CardUpdateOne

ClearName clears the value of name.

func (*CardUpdateOne) ClearOwner Uses

func (cuo *CardUpdateOne) ClearOwner() *CardUpdateOne

ClearOwner clears the owner edge to User.

func (*CardUpdateOne) Exec Uses

func (cuo *CardUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*CardUpdateOne) ExecX Uses

func (cuo *CardUpdateOne) ExecX(ctx context.Context)

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

func (*CardUpdateOne) Save Uses

func (cuo *CardUpdateOne) Save(ctx context.Context) (*Card, error)

Save executes the query and returns the updated entity.

func (*CardUpdateOne) SaveX Uses

func (cuo *CardUpdateOne) SaveX(ctx context.Context) *Card

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

func (*CardUpdateOne) SetName Uses

func (cuo *CardUpdateOne) SetName(s string) *CardUpdateOne

SetName sets the name field.

func (*CardUpdateOne) SetNillableName Uses

func (cuo *CardUpdateOne) SetNillableName(s *string) *CardUpdateOne

SetNillableName sets the name field if the given value is not nil.

func (*CardUpdateOne) SetNillableOwnerID Uses

func (cuo *CardUpdateOne) SetNillableOwnerID(id *string) *CardUpdateOne

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

func (*CardUpdateOne) SetOwner Uses

func (cuo *CardUpdateOne) SetOwner(u *User) *CardUpdateOne

SetOwner sets the owner edge to User.

func (*CardUpdateOne) SetOwnerID Uses

func (cuo *CardUpdateOne) SetOwnerID(id string) *CardUpdateOne

SetOwnerID sets the owner edge to User by id.

type Cards Uses

type Cards []*Card

Cards is a parsable slice of Card.

func (*Cards) FromResponse Uses

func (c *Cards) FromResponse(res *gremlin.Response) error

FromResponse scans the gremlin response data into Cards.

func (*Cards) FromRows Uses

func (c *Cards) FromRows(rows *sql.Rows) error

FromRows scans the sql response data into Cards.

type Client Uses

type Client struct {

    // Schema is the client for creating, migrating and dropping schema.
    Schema *migrate.Schema
    // Card is the client for interacting with the Card builders.
    Card *CardClient
    // Comment is the client for interacting with the Comment builders.
    Comment *CommentClient
    // FieldType is the client for interacting with the FieldType builders.
    FieldType *FieldTypeClient
    // File is the client for interacting with the File builders.
    File *FileClient
    // FileType is the client for interacting with the FileType builders.
    FileType *FileTypeClient
    // Group is the client for interacting with the Group builders.
    Group *GroupClient
    // GroupInfo is the client for interacting with the GroupInfo builders.
    GroupInfo *GroupInfoClient
    // Item is the client for interacting with the Item builders.
    Item *ItemClient
    // Node is the client for interacting with the Node builders.
    Node *NodeClient
    // Pet is the client for interacting with the Pet builders.
    Pet *PetClient
    // 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 Uses

func FromContext(ctx context.Context) *Client

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

func NewClient Uses

func NewClient(opts ...Option) *Client

NewClient creates a new client configured with the given options.

func Open Uses

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

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

func (*Client) Close Uses

func (c *Client) Close() error

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

func (*Client) Debug Uses

func (c *Client) Debug() *Client

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

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

func (*Client) Tx Uses

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

Tx returns a new transactional client.

type Comment Uses

type Comment struct {

    // ID of the ent.
    ID  string `json:"id,omitempty"`
    // UniqueInt holds the value of the "unique_int" field.
    UniqueInt int `json:"unique_int,omitempty"`
    // UniqueFloat holds the value of the "unique_float" field.
    UniqueFloat float64 `json:"unique_float,omitempty"`
    // NillableInt holds the value of the "nillable_int" field.
    NillableInt *int `json:"nillable_int,omitempty"`
    // contains filtered or unexported fields
}

Comment is the model entity for the Comment schema.

Code:

if dsn == "" {
    return
}
ctx := context.Background()
drv, err := sql.Open("mysql", dsn)
if err != nil {
    log.Fatalf("failed creating database client: %v", err)
}
defer drv.Close()
client := NewClient(Driver(drv))
// creating vertices for the comment's edges.

// create comment vertex with its edges.
c := client.Comment.
    Create().
    SetUniqueInt(1).
    SetUniqueFloat(1).
    SetNillableInt(1).
    SaveX(ctx)
log.Println("comment created:", c)

// query edges.

func (*Comment) FromResponse Uses

func (c *Comment) FromResponse(res *gremlin.Response) error

FromResponse scans the gremlin response data into Comment.

func (*Comment) FromRows Uses

func (c *Comment) FromRows(rows *sql.Rows) error

FromRows scans the sql response data into Comment.

func (*Comment) String Uses

func (c *Comment) String() string

String implements the fmt.Stringer.

func (*Comment) Unwrap Uses

func (c *Comment) Unwrap() *Comment

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 (*Comment) Update Uses

func (c *Comment) Update() *CommentUpdateOne

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

type CommentClient Uses

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

CommentClient is a client for the Comment schema.

func NewCommentClient Uses

func NewCommentClient(c config) *CommentClient

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

func (*CommentClient) Create Uses

func (c *CommentClient) Create() *CommentCreate

Create returns a create builder for Comment.

func (*CommentClient) Delete Uses

func (c *CommentClient) Delete() *CommentDelete

Delete returns a delete builder for Comment.

func (*CommentClient) DeleteOne Uses

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

DeleteOne returns a delete builder for the given entity.

func (*CommentClient) DeleteOneID Uses

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

DeleteOneID returns a delete builder for the given id.

func (*CommentClient) Get Uses

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

Get returns a Comment entity by its id.

func (*CommentClient) GetX Uses

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

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

func (*CommentClient) Query Uses

func (c *CommentClient) Query() *CommentQuery

Create returns a query builder for Comment.

func (*CommentClient) Update Uses

func (c *CommentClient) Update() *CommentUpdate

Update returns an update builder for Comment.

func (*CommentClient) UpdateOne Uses

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

UpdateOne returns an update builder for the given entity.

func (*CommentClient) UpdateOneID Uses

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

UpdateOneID returns an update builder for the given id.

type CommentCreate Uses

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

CommentCreate is the builder for creating a Comment entity.

func (*CommentCreate) Save Uses

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

Save creates the Comment in the database.

func (*CommentCreate) SaveX Uses

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

SaveX calls Save and panics if Save returns an error.

func (*CommentCreate) SetNillableInt Uses

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

SetNillableInt sets the nillable_int field.

func (*CommentCreate) SetNillableNillableInt Uses

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

SetNillableNillableInt sets the nillable_int field if the given value is not nil.

func (*CommentCreate) SetUniqueFloat Uses

func (cc *CommentCreate) SetUniqueFloat(f float64) *CommentCreate

SetUniqueFloat sets the unique_float field.

func (*CommentCreate) SetUniqueInt Uses

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

SetUniqueInt sets the unique_int field.

type CommentDelete Uses

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

CommentDelete is the builder for deleting a Comment entity.

func (*CommentDelete) Exec Uses

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

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

func (*CommentDelete) ExecX Uses

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

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

func (*CommentDelete) Where Uses

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

Where adds a new predicate to the delete builder.

type CommentDeleteOne Uses

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

CommentDeleteOne is the builder for deleting a single Comment entity.

func (*CommentDeleteOne) Exec Uses

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

Exec executes the deletion query.

func (*CommentDeleteOne) ExecX Uses

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

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

type CommentGroupBy Uses

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

CommentGroupBy is the builder for group-by Comment entities.

func (*CommentGroupBy) Aggregate Uses

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

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

func (*CommentGroupBy) Bools Uses

func (cgb *CommentGroupBy) 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 (*CommentGroupBy) BoolsX Uses

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

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

func (*CommentGroupBy) Float64s Uses

func (cgb *CommentGroupBy) 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 (*CommentGroupBy) Float64sX Uses

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

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

func (*CommentGroupBy) Ints Uses

func (cgb *CommentGroupBy) 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 (*CommentGroupBy) IntsX Uses

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

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

func (*CommentGroupBy) Scan Uses

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

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

func (*CommentGroupBy) ScanX Uses

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

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

func (*CommentGroupBy) Strings Uses

func (cgb *CommentGroupBy) 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 (*CommentGroupBy) StringsX Uses

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

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

type CommentQuery Uses

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

CommentQuery is the builder for querying Comment entities.

func (*CommentQuery) All Uses

func (cq *CommentQuery) All(ctx context.Context) ([]*Comment, error)

All executes the query and returns a list of Comments.

func (*CommentQuery) AllX Uses

func (cq *CommentQuery) AllX(ctx context.Context) []*Comment

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

func (*CommentQuery) Clone Uses

func (cq *CommentQuery) Clone() *CommentQuery

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 (*CommentQuery) Count Uses

func (cq *CommentQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*CommentQuery) CountX Uses

func (cq *CommentQuery) CountX(ctx context.Context) int

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

func (*CommentQuery) Exist Uses

func (cq *CommentQuery) Exist(ctx context.Context) (bool, error)

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

func (*CommentQuery) ExistX Uses

func (cq *CommentQuery) ExistX(ctx context.Context) bool

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

func (*CommentQuery) First Uses

func (cq *CommentQuery) First(ctx context.Context) (*Comment, error)

First returns the first Comment entity in the query. Returns *ErrNotFound when no comment was found.

func (*CommentQuery) FirstID Uses

func (cq *CommentQuery) FirstID(ctx context.Context) (id string, err error)

FirstID returns the first Comment id in the query. Returns *ErrNotFound when no id was found.

func (*CommentQuery) FirstX Uses

func (cq *CommentQuery) FirstX(ctx context.Context) *Comment

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

func (*CommentQuery) FirstXID Uses

func (cq *CommentQuery) FirstXID(ctx context.Context) string

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

func (*CommentQuery) GroupBy Uses

func (cq *CommentQuery) GroupBy(field string, fields ...string) *CommentGroupBy

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 {
	UniqueInt int `json:"unique_int,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Comment.Query().
	GroupBy(comment.FieldUniqueInt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*CommentQuery) IDs Uses

func (cq *CommentQuery) IDs(ctx context.Context) ([]string, error)

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

func (*CommentQuery) IDsX Uses

func (cq *CommentQuery) IDsX(ctx context.Context) []string

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

func (*CommentQuery) Limit Uses

func (cq *CommentQuery) Limit(limit int) *CommentQuery

Limit adds a limit step to the query.

func (*CommentQuery) Offset Uses

func (cq *CommentQuery) Offset(offset int) *CommentQuery

Offset adds an offset step to the query.

func (*CommentQuery) Only Uses

func (cq *CommentQuery) Only(ctx context.Context) (*Comment, error)

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

func (*CommentQuery) OnlyID Uses

func (cq *CommentQuery) OnlyID(ctx context.Context) (id string, err error)

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

func (*CommentQuery) OnlyX Uses

func (cq *CommentQuery) OnlyX(ctx context.Context) *Comment

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

func (*CommentQuery) OnlyXID Uses

func (cq *CommentQuery) OnlyXID(ctx context.Context) string

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

func (*CommentQuery) Order Uses

func (cq *CommentQuery) Order(o ...Order) *CommentQuery

Order adds an order step to the query.

func (*CommentQuery) Select Uses

func (cq *CommentQuery) Select(field string, fields ...string) *CommentSelect

Select one or more fields from the given query.

Example:

var v []struct {
	UniqueInt int `json:"unique_int,omitempty"`
}

client.Comment.Query().
	Select(comment.FieldUniqueInt).
	Scan(ctx, &v)

func (*CommentQuery) Where Uses

func (cq *CommentQuery) Where(ps ...predicate.Comment) *CommentQuery

Where adds a new predicate for the builder.

type CommentSelect Uses

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

CommentSelect is the builder for select fields of Comment entities.

func (*CommentSelect) Bools Uses

func (cs *CommentSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*CommentSelect) BoolsX Uses

func (cs *CommentSelect) BoolsX(ctx context.Context) []bool

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

func (*CommentSelect) Float64s Uses

func (cs *CommentSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*CommentSelect) Float64sX Uses

func (cs *CommentSelect) Float64sX(ctx context.Context) []float64

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

func (*CommentSelect) Ints Uses

func (cs *CommentSelect) Ints(ctx context.Context) ([]int, error)

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

func (*CommentSelect) IntsX Uses

func (cs *CommentSelect) IntsX(ctx context.Context) []int

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

func (*CommentSelect) Scan Uses

func (cs *CommentSelect) Scan(ctx context.Context, v interface{}) error

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

func (*CommentSelect) ScanX Uses

func (cs *CommentSelect) ScanX(ctx context.Context, v interface{})

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

func (*CommentSelect) Strings Uses

func (cs *CommentSelect) Strings(ctx context.Context) ([]string, error)

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

func (*CommentSelect) StringsX Uses

func (cs *CommentSelect) StringsX(ctx context.Context) []string

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

type CommentUpdate Uses

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

CommentUpdate is the builder for updating Comment entities.

func (*CommentUpdate) AddNillableInt Uses

func (cu *CommentUpdate) AddNillableInt(i int) *CommentUpdate

AddNillableInt adds i to nillable_int.

func (*CommentUpdate) AddUniqueFloat Uses

func (cu *CommentUpdate) AddUniqueFloat(f float64) *CommentUpdate

AddUniqueFloat adds f to unique_float.

func (*CommentUpdate) AddUniqueInt Uses

func (cu *CommentUpdate) AddUniqueInt(i int) *CommentUpdate

AddUniqueInt adds i to unique_int.

func (*CommentUpdate) ClearNillableInt Uses

func (cu *CommentUpdate) ClearNillableInt() *CommentUpdate

ClearNillableInt clears the value of nillable_int.

func (*CommentUpdate) Exec Uses

func (cu *CommentUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*CommentUpdate) ExecX Uses

func (cu *CommentUpdate) ExecX(ctx context.Context)

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

func (*CommentUpdate) Save Uses

func (cu *CommentUpdate) Save(ctx context.Context) (int, error)

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

func (*CommentUpdate) SaveX Uses

func (cu *CommentUpdate) SaveX(ctx context.Context) int

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

func (*CommentUpdate) SetNillableInt Uses

func (cu *CommentUpdate) SetNillableInt(i int) *CommentUpdate

SetNillableInt sets the nillable_int field.

func (*CommentUpdate) SetNillableNillableInt Uses

func (cu *CommentUpdate) SetNillableNillableInt(i *int) *CommentUpdate

SetNillableNillableInt sets the nillable_int field if the given value is not nil.

func (*CommentUpdate) SetUniqueFloat Uses

func (cu *CommentUpdate) SetUniqueFloat(f float64) *CommentUpdate

SetUniqueFloat sets the unique_float field.

func (*CommentUpdate) SetUniqueInt Uses

func (cu *CommentUpdate) SetUniqueInt(i int) *CommentUpdate

SetUniqueInt sets the unique_int field.

func (*CommentUpdate) Where Uses

func (cu *CommentUpdate) Where(ps ...predicate.Comment) *CommentUpdate

Where adds a new predicate for the builder.

type CommentUpdateOne Uses

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

CommentUpdateOne is the builder for updating a single Comment entity.

func (*CommentUpdateOne) AddNillableInt Uses

func (cuo *CommentUpdateOne) AddNillableInt(i int) *CommentUpdateOne

AddNillableInt adds i to nillable_int.

func (*CommentUpdateOne) AddUniqueFloat Uses

func (cuo *CommentUpdateOne) AddUniqueFloat(f float64) *CommentUpdateOne

AddUniqueFloat adds f to unique_float.

func (*CommentUpdateOne) AddUniqueInt Uses

func (cuo *CommentUpdateOne) AddUniqueInt(i int) *CommentUpdateOne

AddUniqueInt adds i to unique_int.

func (*CommentUpdateOne) ClearNillableInt Uses

func (cuo *CommentUpdateOne) ClearNillableInt() *CommentUpdateOne

ClearNillableInt clears the value of nillable_int.

func (*CommentUpdateOne) Exec Uses

func (cuo *CommentUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*CommentUpdateOne) ExecX Uses

func (cuo *CommentUpdateOne) ExecX(ctx context.Context)

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

func (*CommentUpdateOne) Save Uses

func (cuo *CommentUpdateOne) Save(ctx context.Context) (*Comment, error)

Save executes the query and returns the updated entity.

func (*CommentUpdateOne) SaveX Uses

func (cuo *CommentUpdateOne) SaveX(ctx context.Context) *Comment

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

func (*CommentUpdateOne) SetNillableInt Uses

func (cuo *CommentUpdateOne) SetNillableInt(i int) *CommentUpdateOne

SetNillableInt sets the nillable_int field.

func (*CommentUpdateOne) SetNillableNillableInt Uses

func (cuo *CommentUpdateOne) SetNillableNillableInt(i *int) *CommentUpdateOne

SetNillableNillableInt sets the nillable_int field if the given value is not nil.

func (*CommentUpdateOne) SetUniqueFloat Uses

func (cuo *CommentUpdateOne) SetUniqueFloat(f float64) *CommentUpdateOne

SetUniqueFloat sets the unique_float field.

func (*CommentUpdateOne) SetUniqueInt Uses

func (cuo *CommentUpdateOne) SetUniqueInt(i int) *CommentUpdateOne

SetUniqueInt sets the unique_int field.

type Comments Uses

type Comments []*Comment

Comments is a parsable slice of Comment.

func (*Comments) FromResponse Uses

func (c *Comments) FromResponse(res *gremlin.Response) error

FromResponse scans the gremlin response data into Comments.

func (*Comments) FromRows Uses

func (c *Comments) FromRows(rows *sql.Rows) error

FromRows scans the sql response data into Comments.

type ErrConstraintFailed Uses

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

ErrConstraintFailed 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 NewErrUniqueEdge Uses

func NewErrUniqueEdge(label, edge, id string) *ErrConstraintFailed

NewErrUniqueEdge creates a constraint error for unique edges.

func NewErrUniqueField Uses

func NewErrUniqueField(label, field string, v interface{}) *ErrConstraintFailed

NewErrUniqueField creates a constraint error for unique fields.

func (ErrConstraintFailed) Code Uses

func (e ErrConstraintFailed) Code() (string, []interface{})

Code implements the dsl.Node interface.

func (ErrConstraintFailed) Error Uses

func (e ErrConstraintFailed) Error() string

Error implements the error interface.

func (*ErrConstraintFailed) UnmarshalGraphson Uses

func (e *ErrConstraintFailed) UnmarshalGraphson(b []byte) error

func (*ErrConstraintFailed) Unwrap Uses

func (e *ErrConstraintFailed) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type ErrNotFound Uses

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

ErrNotFound returns when trying to fetch a specific entity and it was not found in the database.

func (*ErrNotFound) Error Uses

func (e *ErrNotFound) Error() string

Error implements the error interface.

type ErrNotSingular Uses

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

ErrNotSingular returns when trying to fetch a singular entity and more then one was found in the database.

func (*ErrNotSingular) Error Uses

func (e *ErrNotSingular) Error() string

Error implements the error interface.

type FieldType Uses

type FieldType struct {

    // ID of the ent.
    ID  string `json:"id,omitempty"`
    // Int holds the value of the "int" field.
    Int int `json:"int,omitempty"`
    // Int8 holds the value of the "int8" field.
    Int8 int8 `json:"int8,omitempty"`
    // Int16 holds the value of the "int16" field.
    Int16 int16 `json:"int16,omitempty"`
    // Int32 holds the value of the "int32" field.
    Int32 int32 `json:"int32,omitempty"`
    // Int64 holds the value of the "int64" field.
    Int64 int64 `json:"int64,omitempty"`
    // OptionalInt holds the value of the "optional_int" field.
    OptionalInt int `json:"optional_int,omitempty"`
    // OptionalInt8 holds the value of the "optional_int8" field.
    OptionalInt8 int8 `json:"optional_int8,omitempty"`
    // OptionalInt16 holds the value of the "optional_int16" field.
    OptionalInt16 int16 `json:"optional_int16,omitempty"`
    // OptionalInt32 holds the value of the "optional_int32" field.
    OptionalInt32 int32 `json:"optional_int32,omitempty"`
    // OptionalInt64 holds the value of the "optional_int64" field.
    OptionalInt64 int64 `json:"optional_int64,omitempty"`
    // NillableInt holds the value of the "nillable_int" field.
    NillableInt *int `json:"nillable_int,omitempty"`
    // NillableInt8 holds the value of the "nillable_int8" field.
    NillableInt8 *int8 `json:"nillable_int8,omitempty"`
    // NillableInt16 holds the value of the "nillable_int16" field.
    NillableInt16 *int16 `json:"nillable_int16,omitempty"`
    // NillableInt32 holds the value of the "nillable_int32" field.
    NillableInt32 *int32 `json:"nillable_int32,omitempty"`
    // NillableInt64 holds the value of the "nillable_int64" field.
    NillableInt64 *int64 `json:"nillable_int64,omitempty"`
    // ValidateOptionalInt32 holds the value of the "validate_optional_int32" field.
    ValidateOptionalInt32 int32 `json:"validate_optional_int32,omitempty"`
    // State holds the value of the "state" field.
    State fieldtype.State `json:"state,omitempty"`
    // contains filtered or unexported fields
}

FieldType is the model entity for the FieldType schema.

Code:

if dsn == "" {
    return
}
ctx := context.Background()
drv, err := sql.Open("mysql", dsn)
if err != nil {
    log.Fatalf("failed creating database client: %v", err)
}
defer drv.Close()
client := NewClient(Driver(drv))
// creating vertices for the fieldtype's edges.

// create fieldtype vertex with its edges.
ft := client.FieldType.
    Create().
    SetInt(1).
    SetInt8(1).
    SetInt16(1).
    SetInt32(1).
    SetInt64(1).
    SetOptionalInt(1).
    SetOptionalInt8(1).
    SetOptionalInt16(1).
    SetOptionalInt32(1).
    SetOptionalInt64(1).
    SetNillableInt(1).
    SetNillableInt8(1).
    SetNillableInt16(1).
    SetNillableInt32(1).
    SetNillableInt64(1).
    SetValidateOptionalInt32(1).
    SetState(fieldtype.StateOn).
    SaveX(ctx)
log.Println("fieldtype created:", ft)

// query edges.

func (*FieldType) FromResponse Uses

func (ft *FieldType) FromResponse(res *gremlin.Response) error

FromResponse scans the gremlin response data into FieldType.

func (*FieldType) FromRows Uses

func (ft *FieldType) FromRows(rows *sql.Rows) error

FromRows scans the sql response data into FieldType.

func (*FieldType) String Uses

func (ft *FieldType) String() string

String implements the fmt.Stringer.

func (*FieldType) Unwrap Uses

func (ft *FieldType) Unwrap() *FieldType

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 (*FieldType) Update Uses

func (ft *FieldType) Update() *FieldTypeUpdateOne

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

type FieldTypeClient Uses

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

FieldTypeClient is a client for the FieldType schema.

func NewFieldTypeClient Uses

func NewFieldTypeClient(c config) *FieldTypeClient

NewFieldTypeClient returns a client for the FieldType from the given config.

func (*FieldTypeClient) Create Uses

func (c *FieldTypeClient) Create() *FieldTypeCreate

Create returns a create builder for FieldType.

func (*FieldTypeClient) Delete Uses

func (c *FieldTypeClient) Delete() *FieldTypeDelete

Delete returns a delete builder for FieldType.

func (*FieldTypeClient) DeleteOne Uses

func (c *FieldTypeClient) DeleteOne(ft *FieldType) *FieldTypeDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*FieldTypeClient) DeleteOneID Uses

func (c *FieldTypeClient) DeleteOneID(id string) *FieldTypeDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*FieldTypeClient) Get Uses

func (c *FieldTypeClient) Get(ctx context.Context, id string) (*FieldType, error)

Get returns a FieldType entity by its id.

func (*FieldTypeClient) GetX Uses

func (c *FieldTypeClient) GetX(ctx context.Context, id string) *FieldType

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

func (*FieldTypeClient) Query Uses

func (c *FieldTypeClient) Query() *FieldTypeQuery

Create returns a query builder for FieldType.

func (*FieldTypeClient) Update Uses

func (c *FieldTypeClient) Update() *FieldTypeUpdate

Update returns an update builder for FieldType.

func (*FieldTypeClient) UpdateOne Uses

func (c *FieldTypeClient) UpdateOne(ft *FieldType) *FieldTypeUpdateOne

UpdateOne returns an update builder for the given entity.

func (*FieldTypeClient) UpdateOneID Uses

func (c *FieldTypeClient) UpdateOneID(id string) *FieldTypeUpdateOne

UpdateOneID returns an update builder for the given id.

type FieldTypeCreate Uses

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

FieldTypeCreate is the builder for creating a FieldType entity.

func (*FieldTypeCreate) Save Uses

func (ftc *FieldTypeCreate) Save(ctx context.Context) (*FieldType, error)

Save creates the FieldType in the database.

func (*FieldTypeCreate) SaveX Uses

func (ftc *FieldTypeCreate) SaveX(ctx context.Context) *FieldType

SaveX calls Save and panics if Save returns an error.

func (*FieldTypeCreate) SetInt Uses

func (ftc *FieldTypeCreate) SetInt(i int) *FieldTypeCreate

SetInt sets the int field.

func (*FieldTypeCreate) SetInt16 Uses

func (ftc *FieldTypeCreate) SetInt16(i int16) *FieldTypeCreate

SetInt16 sets the int16 field.

func (*FieldTypeCreate) SetInt32 Uses

func (ftc *FieldTypeCreate) SetInt32(i int32) *FieldTypeCreate

SetInt32 sets the int32 field.

func (*FieldTypeCreate) SetInt64 Uses

func (ftc *FieldTypeCreate) SetInt64(i int64) *FieldTypeCreate

SetInt64 sets the int64 field.

func (*FieldTypeCreate) SetInt8 Uses

func (ftc *FieldTypeCreate) SetInt8(i int8) *FieldTypeCreate

SetInt8 sets the int8 field.

func (*FieldTypeCreate) SetNillableInt Uses

func (ftc *FieldTypeCreate) SetNillableInt(i int) *FieldTypeCreate

SetNillableInt sets the nillable_int field.

func (*FieldTypeCreate) SetNillableInt16 Uses

func (ftc *FieldTypeCreate) SetNillableInt16(i int16) *FieldTypeCreate

SetNillableInt16 sets the nillable_int16 field.

func (*FieldTypeCreate) SetNillableInt32 Uses

func (ftc *FieldTypeCreate) SetNillableInt32(i int32) *FieldTypeCreate

SetNillableInt32 sets the nillable_int32 field.

func (*FieldTypeCreate) SetNillableInt64 Uses

func (ftc *FieldTypeCreate) SetNillableInt64(i int64) *FieldTypeCreate

SetNillableInt64 sets the nillable_int64 field.

func (*FieldTypeCreate) SetNillableInt8 Uses

func (ftc *FieldTypeCreate) SetNillableInt8(i int8) *FieldTypeCreate

SetNillableInt8 sets the nillable_int8 field.

func (*FieldTypeCreate) SetNillableNillableInt Uses

func (ftc *FieldTypeCreate) SetNillableNillableInt(i *int) *FieldTypeCreate

SetNillableNillableInt sets the nillable_int field if the given value is not nil.

func (*FieldTypeCreate) SetNillableNillableInt16 Uses

func (ftc *FieldTypeCreate) SetNillableNillableInt16(i *int16) *FieldTypeCreate

SetNillableNillableInt16 sets the nillable_int16 field if the given value is not nil.

func (*FieldTypeCreate) SetNillableNillableInt32 Uses

func (ftc *FieldTypeCreate) SetNillableNillableInt32(i *int32) *FieldTypeCreate

SetNillableNillableInt32 sets the nillable_int32 field if the given value is not nil.

func (*FieldTypeCreate) SetNillableNillableInt64 Uses

func (ftc *FieldTypeCreate) SetNillableNillableInt64(i *int64) *FieldTypeCreate

SetNillableNillableInt64 sets the nillable_int64 field if the given value is not nil.

func (*FieldTypeCreate) SetNillableNillableInt8 Uses

func (ftc *FieldTypeCreate) SetNillableNillableInt8(i *int8) *FieldTypeCreate

SetNillableNillableInt8 sets the nillable_int8 field if the given value is not nil.

func (*FieldTypeCreate) SetNillableOptionalInt Uses

func (ftc *FieldTypeCreate) SetNillableOptionalInt(i *int) *FieldTypeCreate

SetNillableOptionalInt sets the optional_int field if the given value is not nil.

func (*FieldTypeCreate) SetNillableOptionalInt16 Uses

func (ftc *FieldTypeCreate) SetNillableOptionalInt16(i *int16) *FieldTypeCreate

SetNillableOptionalInt16 sets the optional_int16 field if the given value is not nil.

func (*FieldTypeCreate) SetNillableOptionalInt32 Uses

func (ftc *FieldTypeCreate) SetNillableOptionalInt32(i *int32) *FieldTypeCreate

SetNillableOptionalInt32 sets the optional_int32 field if the given value is not nil.

func (*FieldTypeCreate) SetNillableOptionalInt64 Uses

func (ftc *FieldTypeCreate) SetNillableOptionalInt64(i *int64) *FieldTypeCreate

SetNillableOptionalInt64 sets the optional_int64 field if the given value is not nil.

func (*FieldTypeCreate) SetNillableOptionalInt8 Uses

func (ftc *FieldTypeCreate) SetNillableOptionalInt8(i *int8) *FieldTypeCreate

SetNillableOptionalInt8 sets the optional_int8 field if the given value is not nil.

func (*FieldTypeCreate) SetNillableState Uses

func (ftc *FieldTypeCreate) SetNillableState(f *fieldtype.State) *FieldTypeCreate

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

func (*FieldTypeCreate) SetNillableValidateOptionalInt32 Uses

func (ftc *FieldTypeCreate) SetNillableValidateOptionalInt32(i *int32) *FieldTypeCreate

SetNillableValidateOptionalInt32 sets the validate_optional_int32 field if the given value is not nil.

func (*FieldTypeCreate) SetOptionalInt Uses

func (ftc *FieldTypeCreate) SetOptionalInt(i int) *FieldTypeCreate

SetOptionalInt sets the optional_int field.

func (*FieldTypeCreate) SetOptionalInt16 Uses

func (ftc *FieldTypeCreate) SetOptionalInt16(i int16) *FieldTypeCreate

SetOptionalInt16 sets the optional_int16 field.

func (*FieldTypeCreate) SetOptionalInt32 Uses

func (ftc *FieldTypeCreate) SetOptionalInt32(i int32) *FieldTypeCreate

SetOptionalInt32 sets the optional_int32 field.

func (*FieldTypeCreate) SetOptionalInt64 Uses

func (ftc *FieldTypeCreate) SetOptionalInt64(i int64) *FieldTypeCreate

SetOptionalInt64 sets the optional_int64 field.

func (*FieldTypeCreate) SetOptionalInt8 Uses

func (ftc *FieldTypeCreate) SetOptionalInt8(i int8) *FieldTypeCreate

SetOptionalInt8 sets the optional_int8 field.

func (*FieldTypeCreate) SetState Uses

func (ftc *FieldTypeCreate) SetState(f fieldtype.State) *FieldTypeCreate

SetState sets the state field.

func (*FieldTypeCreate) SetValidateOptionalInt32 Uses

func (ftc *FieldTypeCreate) SetValidateOptionalInt32(i int32) *FieldTypeCreate

SetValidateOptionalInt32 sets the validate_optional_int32 field.

type FieldTypeDelete Uses

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

FieldTypeDelete is the builder for deleting a FieldType entity.

func (*FieldTypeDelete) Exec Uses

func (ftd *FieldTypeDelete) Exec(ctx context.Context) (int, error)

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

func (*FieldTypeDelete) ExecX Uses

func (ftd *FieldTypeDelete) ExecX(ctx context.Context) int

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

func (*FieldTypeDelete) Where Uses

func (ftd *FieldTypeDelete) Where(ps ...predicate.FieldType) *FieldTypeDelete

Where adds a new predicate to the delete builder.

type FieldTypeDeleteOne Uses

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

FieldTypeDeleteOne is the builder for deleting a single FieldType entity.

func (*FieldTypeDeleteOne) Exec Uses

func (ftdo *FieldTypeDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*FieldTypeDeleteOne) ExecX Uses

func (ftdo *FieldTypeDeleteOne) ExecX(ctx context.Context)

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

type FieldTypeGroupBy Uses

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

FieldTypeGroupBy is the builder for group-by FieldType entities.

func (*FieldTypeGroupBy) Aggregate Uses

func (ftgb *FieldTypeGroupBy) Aggregate(fns ...Aggregate) *FieldTypeGroupBy

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

func (*FieldTypeGroupBy) Bools Uses

func (ftgb *FieldTypeGroupBy) 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 (*FieldTypeGroupBy) BoolsX Uses

func (ftgb *FieldTypeGroupBy) BoolsX(ctx context.Context) []bool

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

func (*FieldTypeGroupBy) Float64s Uses

func (ftgb *FieldTypeGroupBy) 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 (*FieldTypeGroupBy) Float64sX Uses

func (ftgb *FieldTypeGroupBy) Float64sX(ctx context.Context) []float64

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

func (*FieldTypeGroupBy) Ints Uses

func (ftgb *FieldTypeGroupBy) 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 (*FieldTypeGroupBy) IntsX Uses

func (ftgb *FieldTypeGroupBy) IntsX(ctx context.Context) []int

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

func (*FieldTypeGroupBy) Scan Uses

func (ftgb *FieldTypeGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*FieldTypeGroupBy) ScanX Uses

func (ftgb *FieldTypeGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*FieldTypeGroupBy) Strings Uses

func (ftgb *FieldTypeGroupBy) 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 (*FieldTypeGroupBy) StringsX Uses

func (ftgb *FieldTypeGroupBy) StringsX(ctx context.Context) []string

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

type FieldTypeQuery Uses

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

FieldTypeQuery is the builder for querying FieldType entities.

func (*FieldTypeQuery) All Uses

func (ftq *FieldTypeQuery) All(ctx context.Context) ([]*FieldType, error)

All executes the query and returns a list of FieldTypes.

func (*FieldTypeQuery) AllX Uses

func (ftq *FieldTypeQuery) AllX(ctx context.Context) []*FieldType

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

func (*FieldTypeQuery) Clone Uses

func (ftq *FieldTypeQuery) Clone() *FieldTypeQuery

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 (*FieldTypeQuery) Count Uses

func (ftq *FieldTypeQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*FieldTypeQuery) CountX Uses

func (ftq *FieldTypeQuery) CountX(ctx context.Context) int

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

func (*FieldTypeQuery) Exist Uses

func (ftq *FieldTypeQuery) Exist(ctx context.Context) (bool, error)

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

func (*FieldTypeQuery) ExistX Uses

func (ftq *FieldTypeQuery) ExistX(ctx context.Context) bool

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

func (*FieldTypeQuery) First Uses

func (ftq *FieldTypeQuery) First(ctx context.Context) (*FieldType, error)

First returns the first FieldType entity in the query. Returns *ErrNotFound when no fieldtype was found.

func (*FieldTypeQuery) FirstID Uses

func (ftq *FieldTypeQuery) FirstID(ctx context.Context) (id string, err error)

FirstID returns the first FieldType id in the query. Returns *ErrNotFound when no id was found.

func (*FieldTypeQuery) FirstX Uses

func (ftq *FieldTypeQuery) FirstX(ctx context.Context) *FieldType

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

func (*FieldTypeQuery) FirstXID Uses

func (ftq *FieldTypeQuery) FirstXID(ctx context.Context) string

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

func (*FieldTypeQuery) GroupBy Uses

func (ftq *FieldTypeQuery) GroupBy(field string, fields ...string) *FieldTypeGroupBy

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 {
	Int int `json:"int,omitempty"`
	Count int `json:"count,omitempty"`
}

client.FieldType.Query().
	GroupBy(fieldtype.FieldInt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*FieldTypeQuery) IDs Uses

func (ftq *FieldTypeQuery) IDs(ctx context.Context) ([]string, error)

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

func (*FieldTypeQuery) IDsX Uses

func (ftq *FieldTypeQuery) IDsX(ctx context.Context) []string

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

func (*FieldTypeQuery) Limit Uses

func (ftq *FieldTypeQuery) Limit(limit int) *FieldTypeQuery

Limit adds a limit step to the query.

func (*FieldTypeQuery) Offset Uses

func (ftq *FieldTypeQuery) Offset(offset int) *FieldTypeQuery

Offset adds an offset step to the query.

func (*FieldTypeQuery) Only Uses

func (ftq *FieldTypeQuery) Only(ctx context.Context) (*FieldType, error)

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

func (*FieldTypeQuery) OnlyID Uses

func (ftq *FieldTypeQuery) OnlyID(ctx context.Context) (id string, err error)

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

func (*FieldTypeQuery) OnlyX Uses

func (ftq *FieldTypeQuery) OnlyX(ctx context.Context) *FieldType

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

func (*FieldTypeQuery) OnlyXID Uses

func (ftq *FieldTypeQuery) OnlyXID(ctx context.Context) string

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

func (*FieldTypeQuery) Order Uses

func (ftq *FieldTypeQuery) Order(o ...Order) *FieldTypeQuery

Order adds an order step to the query.

func (*FieldTypeQuery) Select Uses

func (ftq *FieldTypeQuery) Select(field string, fields ...string) *FieldTypeSelect

Select one or more fields from the given query.

Example:

var v []struct {
	Int int `json:"int,omitempty"`
}

client.FieldType.Query().
	Select(fieldtype.FieldInt).
	Scan(ctx, &v)

func (*FieldTypeQuery) Where Uses

func (ftq *FieldTypeQuery) Where(ps ...predicate.FieldType) *FieldTypeQuery

Where adds a new predicate for the builder.

type FieldTypeSelect Uses

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

FieldTypeSelect is the builder for select fields of FieldType entities.

func (*FieldTypeSelect) Bools Uses

func (fts *FieldTypeSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*FieldTypeSelect) BoolsX Uses

func (fts *FieldTypeSelect) BoolsX(ctx context.Context) []bool

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

func (*FieldTypeSelect) Float64s Uses

func (fts *FieldTypeSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*FieldTypeSelect) Float64sX Uses

func (fts *FieldTypeSelect) Float64sX(ctx context.Context) []float64

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

func (*FieldTypeSelect) Ints Uses

func (fts *FieldTypeSelect) Ints(ctx context.Context) ([]int, error)

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

func (*FieldTypeSelect) IntsX Uses

func (fts *FieldTypeSelect) IntsX(ctx context.Context) []int

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

func (*FieldTypeSelect) Scan Uses

func (fts *FieldTypeSelect) Scan(ctx context.Context, v interface{}) error

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

func (*FieldTypeSelect) ScanX Uses

func (fts *FieldTypeSelect) ScanX(ctx context.Context, v interface{})

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

func (*FieldTypeSelect) Strings Uses

func (fts *FieldTypeSelect) Strings(ctx context.Context) ([]string, error)

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

func (*FieldTypeSelect) StringsX Uses

func (fts *FieldTypeSelect) StringsX(ctx context.Context) []string

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

type FieldTypeUpdate Uses

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

FieldTypeUpdate is the builder for updating FieldType entities.

func (*FieldTypeUpdate) AddInt Uses

func (ftu *FieldTypeUpdate) AddInt(i int) *FieldTypeUpdate

AddInt adds i to int.

func (*FieldTypeUpdate) AddInt16 Uses

func (ftu *FieldTypeUpdate) AddInt16(i int16) *FieldTypeUpdate

AddInt16 adds i to int16.

func (*FieldTypeUpdate) AddInt32 Uses

func (ftu *FieldTypeUpdate) AddInt32(i int32) *FieldTypeUpdate

AddInt32 adds i to int32.

func (*FieldTypeUpdate) AddInt64 Uses

func (ftu *FieldTypeUpdate) AddInt64(i int64) *FieldTypeUpdate

AddInt64 adds i to int64.

func (*FieldTypeUpdate) AddInt8 Uses

func (ftu *FieldTypeUpdate) AddInt8(i int8) *FieldTypeUpdate

AddInt8 adds i to int8.

func (*FieldTypeUpdate) AddNillableInt Uses

func (ftu *FieldTypeUpdate) AddNillableInt(i int) *FieldTypeUpdate

AddNillableInt adds i to nillable_int.

func (*FieldTypeUpdate) AddNillableInt16 Uses

func (ftu *FieldTypeUpdate) AddNillableInt16(i int16) *FieldTypeUpdate

AddNillableInt16 adds i to nillable_int16.

func (*FieldTypeUpdate) AddNillableInt32 Uses

func (ftu *FieldTypeUpdate) AddNillableInt32(i int32) *FieldTypeUpdate

AddNillableInt32 adds i to nillable_int32.

func (*FieldTypeUpdate) AddNillableInt64 Uses

func (ftu *FieldTypeUpdate) AddNillableInt64(i int64) *FieldTypeUpdate

AddNillableInt64 adds i to nillable_int64.

func (*FieldTypeUpdate) AddNillableInt8 Uses

func (ftu *FieldTypeUpdate) AddNillableInt8(i int8) *FieldTypeUpdate

AddNillableInt8 adds i to nillable_int8.

func (*FieldTypeUpdate) AddOptionalInt Uses

func (ftu *FieldTypeUpdate) AddOptionalInt(i int) *FieldTypeUpdate

AddOptionalInt adds i to optional_int.

func (*FieldTypeUpdate) AddOptionalInt16 Uses

func (ftu *FieldTypeUpdate) AddOptionalInt16(i int16) *FieldTypeUpdate

AddOptionalInt16 adds i to optional_int16.

func (*FieldTypeUpdate) AddOptionalInt32 Uses

func (ftu *FieldTypeUpdate) AddOptionalInt32(i int32) *FieldTypeUpdate

AddOptionalInt32 adds i to optional_int32.

func (*FieldTypeUpdate) AddOptionalInt64 Uses

func (ftu *FieldTypeUpdate) AddOptionalInt64(i int64) *FieldTypeUpdate

AddOptionalInt64 adds i to optional_int64.

func (*FieldTypeUpdate) AddOptionalInt8 Uses

func (ftu *FieldTypeUpdate) AddOptionalInt8(i int8) *FieldTypeUpdate

AddOptionalInt8 adds i to optional_int8.

func (*FieldTypeUpdate) AddValidateOptionalInt32 Uses

func (ftu *FieldTypeUpdate) AddValidateOptionalInt32(i int32) *FieldTypeUpdate

AddValidateOptionalInt32 adds i to validate_optional_int32.

func (*FieldTypeUpdate) ClearNillableInt Uses

func (ftu *FieldTypeUpdate) ClearNillableInt() *FieldTypeUpdate

ClearNillableInt clears the value of nillable_int.

func (*FieldTypeUpdate) ClearNillableInt16 Uses

func (ftu *FieldTypeUpdate) ClearNillableInt16() *FieldTypeUpdate

ClearNillableInt16 clears the value of nillable_int16.

func (*FieldTypeUpdate) ClearNillableInt32 Uses

func (ftu *FieldTypeUpdate) ClearNillableInt32() *FieldTypeUpdate

ClearNillableInt32 clears the value of nillable_int32.

func (*FieldTypeUpdate) ClearNillableInt64 Uses

func (ftu *FieldTypeUpdate) ClearNillableInt64() *FieldTypeUpdate

ClearNillableInt64 clears the value of nillable_int64.

func (*FieldTypeUpdate) ClearNillableInt8 Uses

func (ftu *FieldTypeUpdate) ClearNillableInt8() *FieldTypeUpdate

ClearNillableInt8 clears the value of nillable_int8.

func (*FieldTypeUpdate) ClearOptionalInt Uses

func (ftu *FieldTypeUpdate) ClearOptionalInt() *FieldTypeUpdate

ClearOptionalInt clears the value of optional_int.

func (*FieldTypeUpdate) ClearOptionalInt16 Uses

func (ftu *FieldTypeUpdate) ClearOptionalInt16() *FieldTypeUpdate

ClearOptionalInt16 clears the value of optional_int16.

func (*FieldTypeUpdate) ClearOptionalInt32 Uses

func (ftu *FieldTypeUpdate) ClearOptionalInt32() *FieldTypeUpdate

ClearOptionalInt32 clears the value of optional_int32.

func (*FieldTypeUpdate) ClearOptionalInt64 Uses

func (ftu *FieldTypeUpdate) ClearOptionalInt64() *FieldTypeUpdate

ClearOptionalInt64 clears the value of optional_int64.

func (*FieldTypeUpdate) ClearOptionalInt8 Uses

func (ftu *FieldTypeUpdate) ClearOptionalInt8() *FieldTypeUpdate

ClearOptionalInt8 clears the value of optional_int8.

func (*FieldTypeUpdate) ClearState Uses

func (ftu *FieldTypeUpdate) ClearState() *FieldTypeUpdate

ClearState clears the value of state.

func (*FieldTypeUpdate) ClearValidateOptionalInt32 Uses

func (ftu *FieldTypeUpdate) ClearValidateOptionalInt32() *FieldTypeUpdate

ClearValidateOptionalInt32 clears the value of validate_optional_int32.

func (*FieldTypeUpdate) Exec Uses

func (ftu *FieldTypeUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*FieldTypeUpdate) ExecX Uses

func (ftu *FieldTypeUpdate) ExecX(ctx context.Context)

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

func (*FieldTypeUpdate) Save Uses

func (ftu *FieldTypeUpdate) Save(ctx context.Context) (int, error)

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

func (*FieldTypeUpdate) SaveX Uses

func (ftu *FieldTypeUpdate) SaveX(ctx context.Context) int

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

func (*FieldTypeUpdate) SetInt Uses

func (ftu *FieldTypeUpdate) SetInt(i int) *FieldTypeUpdate

SetInt sets the int field.

func (*FieldTypeUpdate) SetInt16 Uses

func (ftu *FieldTypeUpdate) SetInt16(i int16) *FieldTypeUpdate

SetInt16 sets the int16 field.

func (*FieldTypeUpdate) SetInt32 Uses

func (ftu *FieldTypeUpdate) SetInt32(i int32) *FieldTypeUpdate

SetInt32 sets the int32 field.

func (*FieldTypeUpdate) SetInt64 Uses

func (ftu *FieldTypeUpdate) SetInt64(i int64) *FieldTypeUpdate

SetInt64 sets the int64 field.

func (*FieldTypeUpdate) SetInt8 Uses

func (ftu *FieldTypeUpdate) SetInt8(i int8) *FieldTypeUpdate

SetInt8 sets the int8 field.

func (*FieldTypeUpdate) SetNillableInt Uses

func (ftu *FieldTypeUpdate) SetNillableInt(i int) *FieldTypeUpdate

SetNillableInt sets the nillable_int field.

func (*FieldTypeUpdate) SetNillableInt16 Uses

func (ftu *FieldTypeUpdate) SetNillableInt16(i int16) *FieldTypeUpdate

SetNillableInt16 sets the nillable_int16 field.

func (*FieldTypeUpdate) SetNillableInt32 Uses

func (ftu *FieldTypeUpdate) SetNillableInt32(i int32) *FieldTypeUpdate

SetNillableInt32 sets the nillable_int32 field.

func (*FieldTypeUpdate) SetNillableInt64 Uses

func (ftu *FieldTypeUpdate) SetNillableInt64(i int64) *FieldTypeUpdate

SetNillableInt64 sets the nillable_int64 field.

func (*FieldTypeUpdate) SetNillableInt8 Uses

func (ftu *FieldTypeUpdate) SetNillableInt8(i int8) *FieldTypeUpdate

SetNillableInt8 sets the nillable_int8 field.

func (*FieldTypeUpdate) SetNillableNillableInt Uses

func (ftu *FieldTypeUpdate) SetNillableNillableInt(i *int) *FieldTypeUpdate

SetNillableNillableInt sets the nillable_int field if the given value is not nil.

func (*FieldTypeUpdate) SetNillableNillableInt16 Uses

func (ftu *FieldTypeUpdate) SetNillableNillableInt16(i *int16) *FieldTypeUpdate

SetNillableNillableInt16 sets the nillable_int16 field if the given value is not nil.

func (*FieldTypeUpdate) SetNillableNillableInt32 Uses

func (ftu *FieldTypeUpdate) SetNillableNillableInt32(i *int32) *FieldTypeUpdate

SetNillableNillableInt32 sets the nillable_int32 field if the given value is not nil.

func (*FieldTypeUpdate) SetNillableNillableInt64 Uses

func (ftu *FieldTypeUpdate) SetNillableNillableInt64(i *int64) *FieldTypeUpdate

SetNillableNillableInt64 sets the nillable_int64 field if the given value is not nil.

func (*FieldTypeUpdate) SetNillableNillableInt8 Uses

func (ftu *FieldTypeUpdate) SetNillableNillableInt8(i *int8) *FieldTypeUpdate

SetNillableNillableInt8 sets the nillable_int8 field if the given value is not nil.

func (*FieldTypeUpdate) SetNillableOptionalInt Uses

func (ftu *FieldTypeUpdate) SetNillableOptionalInt(i *int) *FieldTypeUpdate

SetNillableOptionalInt sets the optional_int field if the given value is not nil.

func (*FieldTypeUpdate) SetNillableOptionalInt16 Uses

func (ftu *FieldTypeUpdate) SetNillableOptionalInt16(i *int16) *FieldTypeUpdate

SetNillableOptionalInt16 sets the optional_int16 field if the given value is not nil.

func (*FieldTypeUpdate) SetNillableOptionalInt32 Uses

func (ftu *FieldTypeUpdate) SetNillableOptionalInt32(i *int32) *FieldTypeUpdate

SetNillableOptionalInt32 sets the optional_int32 field if the given value is not nil.

func (*FieldTypeUpdate) SetNillableOptionalInt64 Uses

func (ftu *FieldTypeUpdate) SetNillableOptionalInt64(i *int64) *FieldTypeUpdate

SetNillableOptionalInt64 sets the optional_int64 field if the given value is not nil.

func (*FieldTypeUpdate) SetNillableOptionalInt8 Uses

func (ftu *FieldTypeUpdate) SetNillableOptionalInt8(i *int8) *FieldTypeUpdate

SetNillableOptionalInt8 sets the optional_int8 field if the given value is not nil.

func (*FieldTypeUpdate) SetNillableState Uses

func (ftu *FieldTypeUpdate) SetNillableState(f *fieldtype.State) *FieldTypeUpdate

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

func (*FieldTypeUpdate) SetNillableValidateOptionalInt32 Uses

func (ftu *FieldTypeUpdate) SetNillableValidateOptionalInt32(i *int32) *FieldTypeUpdate

SetNillableValidateOptionalInt32 sets the validate_optional_int32 field if the given value is not nil.

func (*FieldTypeUpdate) SetOptionalInt Uses

func (ftu *FieldTypeUpdate) SetOptionalInt(i int) *FieldTypeUpdate

SetOptionalInt sets the optional_int field.

func (*FieldTypeUpdate) SetOptionalInt16 Uses

func (ftu *FieldTypeUpdate) SetOptionalInt16(i int16) *FieldTypeUpdate

SetOptionalInt16 sets the optional_int16 field.

func (*FieldTypeUpdate) SetOptionalInt32 Uses

func (ftu *FieldTypeUpdate) SetOptionalInt32(i int32) *FieldTypeUpdate

SetOptionalInt32 sets the optional_int32 field.

func (*FieldTypeUpdate) SetOptionalInt64 Uses

func (ftu *FieldTypeUpdate) SetOptionalInt64(i int64) *FieldTypeUpdate

SetOptionalInt64 sets the optional_int64 field.

func (*FieldTypeUpdate) SetOptionalInt8 Uses

func (ftu *FieldTypeUpdate) SetOptionalInt8(i int8) *FieldTypeUpdate

SetOptionalInt8 sets the optional_int8 field.

func (*FieldTypeUpdate) SetState Uses

func (ftu *FieldTypeUpdate) SetState(f fieldtype.State) *FieldTypeUpdate

SetState sets the state field.

func (*FieldTypeUpdate) SetValidateOptionalInt32 Uses

func (ftu *FieldTypeUpdate) SetValidateOptionalInt32(i int32) *FieldTypeUpdate

SetValidateOptionalInt32 sets the validate_optional_int32 field.

func (*FieldTypeUpdate) Where Uses

func (ftu *FieldTypeUpdate) Where(ps ...predicate.FieldType) *FieldTypeUpdate

Where adds a new predicate for the builder.

type FieldTypeUpdateOne Uses

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

FieldTypeUpdateOne is the builder for updating a single FieldType entity.

func (*FieldTypeUpdateOne) AddInt Uses

func (ftuo *FieldTypeUpdateOne) AddInt(i int) *FieldTypeUpdateOne

AddInt adds i to int.

func (*FieldTypeUpdateOne) AddInt16 Uses

func (ftuo *FieldTypeUpdateOne) AddInt16(i int16) *FieldTypeUpdateOne

AddInt16 adds i to int16.

func (*FieldTypeUpdateOne) AddInt32 Uses

func (ftuo *FieldTypeUpdateOne) AddInt32(i int32) *FieldTypeUpdateOne

AddInt32 adds i to int32.

func (*FieldTypeUpdateOne) AddInt64 Uses

func (ftuo *FieldTypeUpdateOne) AddInt64(i int64) *FieldTypeUpdateOne

AddInt64 adds i to int64.

func (*FieldTypeUpdateOne) AddInt8 Uses

func (ftuo *FieldTypeUpdateOne) AddInt8(i int8) *FieldTypeUpdateOne

AddInt8 adds i to int8.

func (*FieldTypeUpdateOne) AddNillableInt Uses

func (ftuo *FieldTypeUpdateOne) AddNillableInt(i int) *FieldTypeUpdateOne

AddNillableInt adds i to nillable_int.

func (*FieldTypeUpdateOne) AddNillableInt16 Uses

func (ftuo *FieldTypeUpdateOne) AddNillableInt16(i int16) *FieldTypeUpdateOne

AddNillableInt16 adds i to nillable_int16.

func (*FieldTypeUpdateOne) AddNillableInt32 Uses

func (ftuo *FieldTypeUpdateOne) AddNillableInt32(i int32) *FieldTypeUpdateOne

AddNillableInt32 adds i to nillable_int32.

func (*FieldTypeUpdateOne) AddNillableInt64 Uses

func (ftuo *FieldTypeUpdateOne) AddNillableInt64(i int64) *FieldTypeUpdateOne

AddNillableInt64 adds i to nillable_int64.

func (*FieldTypeUpdateOne) AddNillableInt8 Uses

func (ftuo *FieldTypeUpdateOne) AddNillableInt8(i int8) *FieldTypeUpdateOne

AddNillableInt8 adds i to nillable_int8.

func (*FieldTypeUpdateOne) AddOptionalInt Uses

func (ftuo *FieldTypeUpdateOne) AddOptionalInt(i int) *FieldTypeUpdateOne

AddOptionalInt adds i to optional_int.

func (*FieldTypeUpdateOne) AddOptionalInt16 Uses

func (ftuo *FieldTypeUpdateOne) AddOptionalInt16(i int16) *FieldTypeUpdateOne

AddOptionalInt16 adds i to optional_int16.

func (*FieldTypeUpdateOne) AddOptionalInt32 Uses

func (ftuo *FieldTypeUpdateOne) AddOptionalInt32(i int32) *FieldTypeUpdateOne

AddOptionalInt32 adds i to optional_int32.

func (*FieldTypeUpdateOne) AddOptionalInt64 Uses

func (ftuo *FieldTypeUpdateOne) AddOptionalInt64(i int64) *FieldTypeUpdateOne

AddOptionalInt64 adds i to optional_int64.

func (*FieldTypeUpdateOne) AddOptionalInt8 Uses

func (ftuo *FieldTypeUpdateOne) AddOptionalInt8(i int8) *FieldTypeUpdateOne

AddOptionalInt8 adds i to optional_int8.

func (*FieldTypeUpdateOne) AddValidateOptionalInt32 Uses

func (ftuo *FieldTypeUpdateOne) AddValidateOptionalInt32(i int32) *FieldTypeUpdateOne

AddValidateOptionalInt32 adds i to validate_optional_int32.

func (*FieldTypeUpdateOne) ClearNillableInt Uses

func (ftuo *FieldTypeUpdateOne) ClearNillableInt() *FieldTypeUpdateOne

ClearNillableInt clears the value of nillable_int.

func (*FieldTypeUpdateOne) ClearNillableInt16 Uses

func (ftuo *FieldTypeUpdateOne) ClearNillableInt16() *FieldTypeUpdateOne

ClearNillableInt16 clears the value of nillable_int16.

func (*FieldTypeUpdateOne) ClearNillableInt32 Uses

func (ftuo *FieldTypeUpdateOne) ClearNillableInt32() *FieldTypeUpdateOne

ClearNillableInt32 clears the value of nillable_int32.

func (*FieldTypeUpdateOne) ClearNillableInt64 Uses

func (ftuo *FieldTypeUpdateOne) ClearNillableInt64() *FieldTypeUpdateOne

ClearNillableInt64 clears the value of nillable_int64.

func (*FieldTypeUpdateOne) ClearNillableInt8 Uses

func (ftuo *FieldTypeUpdateOne) ClearNillableInt8() *FieldTypeUpdateOne

ClearNillableInt8 clears the value of nillable_int8.

func (*FieldTypeUpdateOne) ClearOptionalInt Uses

func (ftuo *FieldTypeUpdateOne) ClearOptionalInt() *FieldTypeUpdateOne

ClearOptionalInt clears the value of optional_int.

func (*FieldTypeUpdateOne) ClearOptionalInt16 Uses

func (ftuo *FieldTypeUpdateOne) ClearOptionalInt16() *FieldTypeUpdateOne

ClearOptionalInt16 clears the value of optional_int16.

func (*FieldTypeUpdateOne) ClearOptionalInt32 Uses

func (ftuo *FieldTypeUpdateOne) ClearOptionalInt32() *FieldTypeUpdateOne

ClearOptionalInt32 clears the value of optional_int32.

func (*FieldTypeUpdateOne) ClearOptionalInt64 Uses

func (ftuo *FieldTypeUpdateOne) ClearOptionalInt64() *FieldTypeUpdateOne

ClearOptionalInt64 clears the value of optional_int64.

func (*FieldTypeUpdateOne) ClearOptionalInt8 Uses

func (ftuo *FieldTypeUpdateOne) ClearOptionalInt8() *FieldTypeUpdateOne

ClearOptionalInt8 clears the value of optional_int8.

func (*FieldTypeUpdateOne) ClearState Uses

func (ftuo *FieldTypeUpdateOne) ClearState() *FieldTypeUpdateOne

ClearState clears the value of state.

func (*FieldTypeUpdateOne) ClearValidateOptionalInt32 Uses

func (ftuo *FieldTypeUpdateOne) ClearValidateOptionalInt32() *FieldTypeUpdateOne

ClearValidateOptionalInt32 clears the value of validate_optional_int32.

func (*FieldTypeUpdateOne) Exec Uses

func (ftuo *FieldTypeUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*FieldTypeUpdateOne) ExecX Uses

func (ftuo *FieldTypeUpdateOne) ExecX(ctx context.Context)

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

func (*FieldTypeUpdateOne) Save Uses

func (ftuo *FieldTypeUpdateOne) Save(ctx context.Context) (*FieldType, error)

Save executes the query and returns the updated entity.

func (*FieldTypeUpdateOne) SaveX Uses

func (ftuo *FieldTypeUpdateOne) SaveX(ctx context.Context) *FieldType

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

func (*FieldTypeUpdateOne) SetInt Uses

func (ftuo *FieldTypeUpdateOne) SetInt(i int) *FieldTypeUpdateOne

SetInt sets the int field.

func (*FieldTypeUpdateOne) SetInt16 Uses

func (ftuo *FieldTypeUpdateOne) SetInt16(i int16) *FieldTypeUpdateOne

SetInt16 sets the int16 field.

func (*FieldTypeUpdateOne) SetInt32 Uses

func (ftuo *FieldTypeUpdateOne) SetInt32(i int32) *FieldTypeUpdateOne

SetInt32 sets the int32 field.

func (*FieldTypeUpdateOne) SetInt64 Uses

func (ftuo *FieldTypeUpdateOne) SetInt64(i int64) *FieldTypeUpdateOne

SetInt64 sets the int64 field.

func (*FieldTypeUpdateOne) SetInt8 Uses

func (ftuo *FieldTypeUpdateOne) SetInt8(i int8) *FieldTypeUpdateOne

SetInt8 sets the int8 field.

func (*FieldTypeUpdateOne) SetNillableInt Uses

func (ftuo *FieldTypeUpdateOne) SetNillableInt(i int) *FieldTypeUpdateOne

SetNillableInt sets the nillable_int field.

func (*FieldTypeUpdateOne) SetNillableInt16 Uses

func (ftuo *FieldTypeUpdateOne) SetNillableInt16(i int16) *FieldTypeUpdateOne

SetNillableInt16 sets the nillable_int16 field.

func (*FieldTypeUpdateOne) SetNillableInt32 Uses

func (ftuo *FieldTypeUpdateOne) SetNillableInt32(i int32) *FieldTypeUpdateOne

SetNillableInt32 sets the nillable_int32 field.

func (*FieldTypeUpdateOne) SetNillableInt64 Uses

func (ftuo *FieldTypeUpdateOne) SetNillableInt64(i int64) *FieldTypeUpdateOne

SetNillableInt64 sets the nillable_int64 field.

func (*FieldTypeUpdateOne) SetNillableInt8 Uses

func (ftuo *FieldTypeUpdateOne) SetNillableInt8(i int8) *FieldTypeUpdateOne

SetNillableInt8 sets the nillable_int8 field.

func (*FieldTypeUpdateOne) SetNillableNillableInt Uses

func (ftuo *FieldTypeUpdateOne) SetNillableNillableInt(i *int) *FieldTypeUpdateOne

SetNillableNillableInt sets the nillable_int field if the given value is not nil.

func (*FieldTypeUpdateOne) SetNillableNillableInt16 Uses

func (ftuo *FieldTypeUpdateOne) SetNillableNillableInt16(i *int16) *FieldTypeUpdateOne

SetNillableNillableInt16 sets the nillable_int16 field if the given value is not nil.

func (*FieldTypeUpdateOne) SetNillableNillableInt32 Uses

func (ftuo *FieldTypeUpdateOne) SetNillableNillableInt32(i *int32) *FieldTypeUpdateOne

SetNillableNillableInt32 sets the nillable_int32 field if the given value is not nil.

func (*FieldTypeUpdateOne) SetNillableNillableInt64 Uses

func (ftuo *FieldTypeUpdateOne) SetNillableNillableInt64(i *int64) *FieldTypeUpdateOne

SetNillableNillableInt64 sets the nillable_int64 field if the given value is not nil.

func (*FieldTypeUpdateOne) SetNillableNillableInt8 Uses

func (ftuo *FieldTypeUpdateOne) SetNillableNillableInt8(i *int8) *FieldTypeUpdateOne

SetNillableNillableInt8 sets the nillable_int8 field if the given value is not nil.

func (*FieldTypeUpdateOne) SetNillableOptionalInt Uses

func (ftuo *FieldTypeUpdateOne) SetNillableOptionalInt(i *int) *FieldTypeUpdateOne

SetNillableOptionalInt sets the optional_int field if the given value is not nil.

func (*FieldTypeUpdateOne) SetNillableOptionalInt16 Uses

func (ftuo *FieldTypeUpdateOne) SetNillableOptionalInt16(i *int16) *FieldTypeUpdateOne

SetNillableOptionalInt16 sets the optional_int16 field if the given value is not nil.

func (*FieldTypeUpdateOne) SetNillableOptionalInt32 Uses

func (ftuo *FieldTypeUpdateOne) SetNillableOptionalInt32(i *int32) *FieldTypeUpdateOne

SetNillableOptionalInt32 sets the optional_int32 field if the given value is not nil.

func (*FieldTypeUpdateOne) SetNillableOptionalInt64 Uses

func (ftuo *FieldTypeUpdateOne) SetNillableOptionalInt64(i *int64) *FieldTypeUpdateOne

SetNillableOptionalInt64 sets the optional_int64 field if the given value is not nil.

func (*FieldTypeUpdateOne) SetNillableOptionalInt8 Uses

func (ftuo *FieldTypeUpdateOne) SetNillableOptionalInt8(i *int8) *FieldTypeUpdateOne

SetNillableOptionalInt8 sets the optional_int8 field if the given value is not nil.

func (*FieldTypeUpdateOne) SetNillableState Uses

func (ftuo *FieldTypeUpdateOne) SetNillableState(f *fieldtype.State) *FieldTypeUpdateOne

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

func (*FieldTypeUpdateOne) SetNillableValidateOptionalInt32 Uses

func (ftuo *FieldTypeUpdateOne) SetNillableValidateOptionalInt32(i *int32) *FieldTypeUpdateOne

SetNillableValidateOptionalInt32 sets the validate_optional_int32 field if the given value is not nil.

func (*FieldTypeUpdateOne) SetOptionalInt Uses

func (ftuo *FieldTypeUpdateOne) SetOptionalInt(i int) *FieldTypeUpdateOne

SetOptionalInt sets the optional_int field.

func (*FieldTypeUpdateOne) SetOptionalInt16 Uses

func (ftuo *FieldTypeUpdateOne) SetOptionalInt16(i int16) *FieldTypeUpdateOne

SetOptionalInt16 sets the optional_int16 field.

func (*FieldTypeUpdateOne) SetOptionalInt32 Uses

func (ftuo *FieldTypeUpdateOne) SetOptionalInt32(i int32) *FieldTypeUpdateOne

SetOptionalInt32 sets the optional_int32 field.

func (*FieldTypeUpdateOne) SetOptionalInt64 Uses

func (ftuo *FieldTypeUpdateOne) SetOptionalInt64(i int64) *FieldTypeUpdateOne

SetOptionalInt64 sets the optional_int64 field.

func (*FieldTypeUpdateOne) SetOptionalInt8 Uses

func (ftuo *FieldTypeUpdateOne) SetOptionalInt8(i int8) *FieldTypeUpdateOne

SetOptionalInt8 sets the optional_int8 field.

func (*FieldTypeUpdateOne) SetState Uses

func (ftuo *FieldTypeUpdateOne) SetState(f fieldtype.State) *FieldTypeUpdateOne

SetState sets the state field.

func (*FieldTypeUpdateOne) SetValidateOptionalInt32 Uses

func (ftuo *FieldTypeUpdateOne) SetValidateOptionalInt32(i int32) *FieldTypeUpdateOne

SetValidateOptionalInt32 sets the validate_optional_int32 field.

type FieldTypes Uses

type FieldTypes []*FieldType

FieldTypes is a parsable slice of FieldType.

func (*FieldTypes) FromResponse Uses

func (ft *FieldTypes) FromResponse(res *gremlin.Response) error

FromResponse scans the gremlin response data into FieldTypes.

func (*FieldTypes) FromRows Uses

func (ft *FieldTypes) FromRows(rows *sql.Rows) error

FromRows scans the sql response data into FieldTypes.

type File Uses

type File struct {

    // ID of the ent.
    ID  string `json:"id,omitempty"`
    // Size holds the value of the "size" field.
    Size int `json:"size,omitempty"`
    // Name holds the value of the "name" field.
    Name string `json:"name,omitempty"`
    // User holds the value of the "user" field.
    User *string `json:"user,omitempty"`
    // Group holds the value of the "group" field.
    Group string `json:"group,omitempty"`
    // contains filtered or unexported fields
}

File is the model entity for the File schema.

Code:

if dsn == "" {
    return
}
ctx := context.Background()
drv, err := sql.Open("mysql", dsn)
if err != nil {
    log.Fatalf("failed creating database client: %v", err)
}
defer drv.Close()
client := NewClient(Driver(drv))
// creating vertices for the file's edges.

// create file vertex with its edges.
f := client.File.
    Create().
    SetSize(1).
    SetName("string").
    SetUser("string").
    SetGroup("string").
    SaveX(ctx)
log.Println("file created:", f)

// query edges.

func (*File) FromResponse Uses

func (f *File) FromResponse(res *gremlin.Response) error

FromResponse scans the gremlin response data into File.

func (*File) FromRows Uses

func (f *File) FromRows(rows *sql.Rows) error

FromRows scans the sql response data into File.

func (*File) QueryOwner Uses

func (f *File) QueryOwner() *UserQuery

QueryOwner queries the owner edge of the File.

func (*File) QueryType Uses

func (f *File) QueryType() *FileTypeQuery

QueryType queries the type edge of the File.

func (*File) String Uses

func (f *File) String() string

String implements the fmt.Stringer.

func (*File) Unwrap Uses

func (f *File) Unwrap() *File

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 (*File) Update Uses

func (f *File) Update() *FileUpdateOne

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

type FileClient Uses

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

FileClient is a client for the File schema.

func NewFileClient Uses

func NewFileClient(c config) *FileClient

NewFileClient returns a client for the File from the given config.

func (*FileClient) Create Uses

func (c *FileClient) Create() *FileCreate

Create returns a create builder for File.

func (*FileClient) Delete Uses

func (c *FileClient) Delete() *FileDelete

Delete returns a delete builder for File.

func (*FileClient) DeleteOne Uses

func (c *FileClient) DeleteOne(f *File) *FileDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*FileClient) DeleteOneID Uses

func (c *FileClient) DeleteOneID(id string) *FileDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*FileClient) Get Uses

func (c *FileClient) Get(ctx context.Context, id string) (*File, error)

Get returns a File entity by its id.

func (*FileClient) GetX Uses

func (c *FileClient) GetX(ctx context.Context, id string) *File

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

func (*FileClient) Query Uses

func (c *FileClient) Query() *FileQuery

Create returns a query builder for File.

func (*FileClient) QueryOwner Uses

func (c *FileClient) QueryOwner(f *File) *UserQuery

QueryOwner queries the owner edge of a File.

func (*FileClient) QueryType Uses

func (c *FileClient) QueryType(f *File) *FileTypeQuery

QueryType queries the type edge of a File.

func (*FileClient) Update Uses

func (c *FileClient) Update() *FileUpdate

Update returns an update builder for File.

func (*FileClient) UpdateOne Uses

func (c *FileClient) UpdateOne(f *File) *FileUpdateOne

UpdateOne returns an update builder for the given entity.

func (*FileClient) UpdateOneID Uses

func (c *FileClient) UpdateOneID(id string) *FileUpdateOne

UpdateOneID returns an update builder for the given id.

type FileCreate Uses

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

FileCreate is the builder for creating a File entity.

func (*FileCreate) Save Uses

func (fc *FileCreate) Save(ctx context.Context) (*File, error)

Save creates the File in the database.

func (*FileCreate) SaveX Uses

func (fc *FileCreate) SaveX(ctx context.Context) *File

SaveX calls Save and panics if Save returns an error.

func (*FileCreate) SetGroup Uses

func (fc *FileCreate) SetGroup(s string) *FileCreate

SetGroup sets the group field.

func (*FileCreate) SetName Uses

func (fc *FileCreate) SetName(s string) *FileCreate

SetName sets the name field.

func (*FileCreate) SetNillableGroup Uses

func (fc *FileCreate) SetNillableGroup(s *string) *FileCreate

SetNillableGroup sets the group field if the given value is not nil.

func (*FileCreate) SetNillableOwnerID Uses

func (fc *FileCreate) SetNillableOwnerID(id *string) *FileCreate

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

func (*FileCreate) SetNillableSize Uses

func (fc *FileCreate) SetNillableSize(i *int) *FileCreate

SetNillableSize sets the size field if the given value is not nil.

func (*FileCreate) SetNillableTypeID Uses

func (fc *FileCreate) SetNillableTypeID(id *string) *FileCreate

SetNillableTypeID sets the type edge to FileType by id if the given value is not nil.

func (*FileCreate) SetNillableUser Uses

func (fc *FileCreate) SetNillableUser(s *string) *FileCreate

SetNillableUser sets the user field if the given value is not nil.

func (*FileCreate) SetOwner Uses

func (fc *FileCreate) SetOwner(u *User) *FileCreate

SetOwner sets the owner edge to User.

func (*FileCreate) SetOwnerID Uses

func (fc *FileCreate) SetOwnerID(id string) *FileCreate

SetOwnerID sets the owner edge to User by id.

func (*FileCreate) SetSize Uses

func (fc *FileCreate) SetSize(i int) *FileCreate

SetSize sets the size field.

func (*FileCreate) SetType Uses

func (fc *FileCreate) SetType(f *FileType) *FileCreate

SetType sets the type edge to FileType.

func (*FileCreate) SetTypeID Uses

func (fc *FileCreate) SetTypeID(id string) *FileCreate

SetTypeID sets the type edge to FileType by id.

func (*FileCreate) SetUser Uses

func (fc *FileCreate) SetUser(s string) *FileCreate

SetUser sets the user field.

type FileDelete Uses

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

FileDelete is the builder for deleting a File entity.

func (*FileDelete) Exec Uses

func (fd *FileDelete) Exec(ctx context.Context) (int, error)

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

func (*FileDelete) ExecX Uses

func (fd *FileDelete) ExecX(ctx context.Context) int

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

func (*FileDelete) Where Uses

func (fd *FileDelete) Where(ps ...predicate.File) *FileDelete

Where adds a new predicate to the delete builder.

type FileDeleteOne Uses

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

FileDeleteOne is the builder for deleting a single File entity.

func (*FileDeleteOne) Exec Uses

func (fdo *FileDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*FileDeleteOne) ExecX Uses

func (fdo *FileDeleteOne) ExecX(ctx context.Context)

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

type FileGroupBy Uses

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

FileGroupBy is the builder for group-by File entities.

func (*FileGroupBy) Aggregate Uses

func (fgb *FileGroupBy) Aggregate(fns ...Aggregate) *FileGroupBy

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

func (*FileGroupBy) Bools Uses

func (fgb *FileGroupBy) 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 (*FileGroupBy) BoolsX Uses

func (fgb *FileGroupBy) BoolsX(ctx context.Context) []bool

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

func (*FileGroupBy) Float64s Uses

func (fgb *FileGroupBy) 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 (*FileGroupBy) Float64sX Uses

func (fgb *FileGroupBy) Float64sX(ctx context.Context) []float64

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

func (*FileGroupBy) Ints Uses

func (fgb *FileGroupBy) 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 (*FileGroupBy) IntsX Uses

func (fgb *FileGroupBy) IntsX(ctx context.Context) []int

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

func (*FileGroupBy) Scan Uses

func (fgb *FileGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*FileGroupBy) ScanX Uses

func (fgb *FileGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*FileGroupBy) Strings Uses

func (fgb *FileGroupBy) 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 (*FileGroupBy) StringsX Uses

func (fgb *FileGroupBy) StringsX(ctx context.Context) []string

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

type FileQuery Uses

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

FileQuery is the builder for querying File entities.

func (*FileQuery) All Uses

func (fq *FileQuery) All(ctx context.Context) ([]*File, error)

All executes the query and returns a list of Files.

func (*FileQuery) AllX Uses

func (fq *FileQuery) AllX(ctx context.Context) []*File

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

func (*FileQuery) Clone Uses

func (fq *FileQuery) Clone() *FileQuery

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 (*FileQuery) Count Uses

func (fq *FileQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*FileQuery) CountX Uses

func (fq *FileQuery) CountX(ctx context.Context) int

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

func (*FileQuery) Exist Uses

func (fq *FileQuery) Exist(ctx context.Context) (bool, error)

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

func (*FileQuery) ExistX Uses

func (fq *FileQuery) ExistX(ctx context.Context) bool

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

func (*FileQuery) First Uses

func (fq *FileQuery) First(ctx context.Context) (*File, error)

First returns the first File entity in the query. Returns *ErrNotFound when no file was found.

func (*FileQuery) FirstID Uses

func (fq *FileQuery) FirstID(ctx context.Context) (id string, err error)

FirstID returns the first File id in the query. Returns *ErrNotFound when no id was found.

func (*FileQuery) FirstX Uses

func (fq *FileQuery) FirstX(ctx context.Context) *File

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

func (*FileQuery) FirstXID Uses

func (fq *FileQuery) FirstXID(ctx context.Context) string

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

func (*FileQuery) GroupBy Uses

func (fq *FileQuery) GroupBy(field string, fields ...string) *FileGroupBy

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 {
	Size int `json:"size,omitempty"`
	Count int `json:"count,omitempty"`
}

client.File.Query().
	GroupBy(file.FieldSize).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*FileQuery) IDs Uses

func (fq *FileQuery) IDs(ctx context.Context) ([]string, error)

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

func (*FileQuery) IDsX Uses

func (fq *FileQuery) IDsX(ctx context.Context) []string

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

func (*FileQuery) Limit Uses

func (fq *FileQuery) Limit(limit int) *FileQuery

Limit adds a limit step to the query.

func (*FileQuery) Offset Uses

func (fq *FileQuery) Offset(offset int) *FileQuery

Offset adds an offset step to the query.

func (*FileQuery) Only Uses

func (fq *FileQuery) Only(ctx context.Context) (*File, error)

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

func (*FileQuery) OnlyID Uses

func (fq *FileQuery) OnlyID(ctx context.Context) (id string, err error)

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

func (*FileQuery) OnlyX Uses

func (fq *FileQuery) OnlyX(ctx context.Context) *File

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

func (*FileQuery) OnlyXID Uses

func (fq *FileQuery) OnlyXID(ctx context.Context) string

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

func (*FileQuery) Order Uses

func (fq *FileQuery) Order(o ...Order) *FileQuery

Order adds an order step to the query.

func (*FileQuery) QueryOwner Uses

func (fq *FileQuery) QueryOwner() *UserQuery

QueryOwner chains the current query on the owner edge.

func (*FileQuery) QueryType Uses

func (fq *FileQuery) QueryType() *FileTypeQuery

QueryType chains the current query on the type edge.

func (*FileQuery) Select Uses

func (fq *FileQuery) Select(field string, fields ...string) *FileSelect

Select one or more fields from the given query.

Example:

var v []struct {
	Size int `json:"size,omitempty"`
}

client.File.Query().
	Select(file.FieldSize).
	Scan(ctx, &v)

func (*FileQuery) Where Uses

func (fq *FileQuery) Where(ps ...predicate.File) *FileQuery

Where adds a new predicate for the builder.

type FileSelect Uses

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

FileSelect is the builder for select fields of File entities.

func (*FileSelect) Bools Uses

func (fs *FileSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*FileSelect) BoolsX Uses

func (fs *FileSelect) BoolsX(ctx context.Context) []bool

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

func (*FileSelect) Float64s Uses

func (fs *FileSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*FileSelect) Float64sX Uses

func (fs *FileSelect) Float64sX(ctx context.Context) []float64

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

func (*FileSelect) Ints Uses

func (fs *FileSelect) Ints(ctx context.Context) ([]int, error)

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

func (*FileSelect) IntsX Uses

func (fs *FileSelect) IntsX(ctx context.Context) []int

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

func (*FileSelect) Scan Uses

func (fs *FileSelect) Scan(ctx context.Context, v interface{}) error

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

func (*FileSelect) ScanX Uses

func (fs *FileSelect) ScanX(ctx context.Context, v interface{})

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

func (*FileSelect) Strings Uses

func (fs *FileSelect) Strings(ctx context.Context) ([]string, error)

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

func (*FileSelect) StringsX Uses

func (fs *FileSelect) StringsX(ctx context.Context) []string

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

type FileType Uses

type FileType struct {

    // ID of the ent.
    ID  string `json:"id,omitempty"`
    // Name holds the value of the "name" field.
    Name string `json:"name,omitempty"`
    // contains filtered or unexported fields
}

FileType is the model entity for the FileType schema.

Code:

if dsn == "" {
    return
}
ctx := context.Background()
drv, err := sql.Open("mysql", dsn)
if err != nil {
    log.Fatalf("failed creating database client: %v", err)
}
defer drv.Close()
client := NewClient(Driver(drv))
// creating vertices for the filetype's edges.
f0 := client.File.
    Create().
    SetSize(1).
    SetName("string").
    SetUser("string").
    SetGroup("string").
    SaveX(ctx)
log.Println("file created:", f0)

// create filetype vertex with its edges.
ft := client.FileType.
    Create().
    SetName("string").
    AddFiles(f0).
    SaveX(ctx)
log.Println("filetype created:", ft)

// query edges.
f0, err = ft.QueryFiles().First(ctx)
if err != nil {
    log.Fatalf("failed querying files: %v", err)
}
log.Println("files found:", f0)

func (*FileType) FromResponse Uses

func (ft *FileType) FromResponse(res *gremlin.Response) error

FromResponse scans the gremlin response data into FileType.

func (*FileType) FromRows Uses

func (ft *FileType) FromRows(rows *sql.Rows) error

FromRows scans the sql response data into FileType.

func (*FileType) QueryFiles Uses

func (ft *FileType) QueryFiles() *FileQuery

QueryFiles queries the files edge of the FileType.

func (*FileType) String Uses

func (ft *FileType) String() string

String implements the fmt.Stringer.

func (*FileType) Unwrap Uses

func (ft *FileType) Unwrap() *FileType

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 (*FileType) Update Uses

func (ft *FileType) Update() *FileTypeUpdateOne

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

type FileTypeClient Uses

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

FileTypeClient is a client for the FileType schema.

func NewFileTypeClient Uses

func NewFileTypeClient(c config) *FileTypeClient

NewFileTypeClient returns a client for the FileType from the given config.

func (*FileTypeClient) Create Uses

func (c *FileTypeClient) Create() *FileTypeCreate

Create returns a create builder for FileType.

func (*FileTypeClient) Delete Uses

func (c *FileTypeClient) Delete() *FileTypeDelete

Delete returns a delete builder for FileType.

func (*FileTypeClient) DeleteOne Uses

func (c *FileTypeClient) DeleteOne(ft *FileType) *FileTypeDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*FileTypeClient) DeleteOneID Uses

func (c *FileTypeClient) DeleteOneID(id string) *FileTypeDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*FileTypeClient) Get Uses

func (c *FileTypeClient) Get(ctx context.Context, id string) (*FileType, error)

Get returns a FileType entity by its id.

func (*FileTypeClient) GetX Uses

func (c *FileTypeClient) GetX(ctx context.Context, id string) *FileType

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

func (*FileTypeClient) Query Uses

func (c *FileTypeClient) Query() *FileTypeQuery

Create returns a query builder for FileType.

func (*FileTypeClient) QueryFiles Uses

func (c *FileTypeClient) QueryFiles(ft *FileType) *FileQuery

QueryFiles queries the files edge of a FileType.

func (*FileTypeClient) Update Uses

func (c *FileTypeClient) Update() *FileTypeUpdate

Update returns an update builder for FileType.

func (*FileTypeClient) UpdateOne Uses

func (c *FileTypeClient) UpdateOne(ft *FileType) *FileTypeUpdateOne

UpdateOne returns an update builder for the given entity.

func (*FileTypeClient) UpdateOneID Uses

func (c *FileTypeClient) UpdateOneID(id string) *FileTypeUpdateOne

UpdateOneID returns an update builder for the given id.

type FileTypeCreate Uses

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

FileTypeCreate is the builder for creating a FileType entity.

func (*FileTypeCreate) AddFileIDs Uses

func (ftc *FileTypeCreate) AddFileIDs(ids ...string) *FileTypeCreate

AddFileIDs adds the files edge to File by ids.

func (*FileTypeCreate) AddFiles Uses

func (ftc *FileTypeCreate) AddFiles(f ...*File) *FileTypeCreate

AddFiles adds the files edges to File.

func (*FileTypeCreate) Save Uses

func (ftc *FileTypeCreate) Save(ctx context.Context) (*FileType, error)

Save creates the FileType in the database.

func (*FileTypeCreate) SaveX Uses

func (ftc *FileTypeCreate) SaveX(ctx context.Context) *FileType

SaveX calls Save and panics if Save returns an error.

func (*FileTypeCreate) SetName Uses

func (ftc *FileTypeCreate) SetName(s string) *FileTypeCreate

SetName sets the name field.

type FileTypeDelete Uses

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

FileTypeDelete is the builder for deleting a FileType entity.

func (*FileTypeDelete) Exec Uses

func (ftd *FileTypeDelete) Exec(ctx context.Context) (int, error)

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

func (*FileTypeDelete) ExecX Uses

func (ftd *FileTypeDelete) ExecX(ctx context.Context) int

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

func (*FileTypeDelete) Where Uses

func (ftd *FileTypeDelete) Where(ps ...predicate.FileType) *FileTypeDelete

Where adds a new predicate to the delete builder.

type FileTypeDeleteOne Uses

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

FileTypeDeleteOne is the builder for deleting a single FileType entity.

func (*FileTypeDeleteOne) Exec Uses

func (ftdo *FileTypeDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*FileTypeDeleteOne) ExecX Uses

func (ftdo *FileTypeDeleteOne) ExecX(ctx context.Context)

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

type FileTypeGroupBy Uses

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

FileTypeGroupBy is the builder for group-by FileType entities.

func (*FileTypeGroupBy) Aggregate Uses

func (ftgb *FileTypeGroupBy) Aggregate(fns ...Aggregate) *FileTypeGroupBy

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

func (*FileTypeGroupBy) Bools Uses

func (ftgb *FileTypeGroupBy) 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 (*FileTypeGroupBy) BoolsX Uses

func (ftgb *FileTypeGroupBy) BoolsX(ctx context.Context) []bool

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

func (*FileTypeGroupBy) Float64s Uses

func (ftgb *FileTypeGroupBy) 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 (*FileTypeGroupBy) Float64sX Uses

func (ftgb *FileTypeGroupBy) Float64sX(ctx context.Context) []float64

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

func (*FileTypeGroupBy) Ints Uses

func (ftgb *FileTypeGroupBy) 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 (*FileTypeGroupBy) IntsX Uses

func (ftgb *FileTypeGroupBy) IntsX(ctx context.Context) []int

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

func (*FileTypeGroupBy) Scan Uses

func (ftgb *FileTypeGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*FileTypeGroupBy) ScanX Uses

func (ftgb *FileTypeGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*FileTypeGroupBy) Strings Uses

func (ftgb *FileTypeGroupBy) 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 (*FileTypeGroupBy) StringsX Uses

func (ftgb *FileTypeGroupBy) StringsX(ctx context.Context) []string

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

type FileTypeQuery Uses

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

FileTypeQuery is the builder for querying FileType entities.

func (*FileTypeQuery) All Uses

func (ftq *FileTypeQuery) All(ctx context.Context) ([]*FileType, error)

All executes the query and returns a list of FileTypes.

func (*FileTypeQuery) AllX Uses

func (ftq *FileTypeQuery) AllX(ctx context.Context) []*FileType

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

func (*FileTypeQuery) Clone Uses

func (ftq *FileTypeQuery) Clone() *FileTypeQuery

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 (*FileTypeQuery) Count Uses

func (ftq *FileTypeQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*FileTypeQuery) CountX Uses

func (ftq *FileTypeQuery) CountX(ctx context.Context) int

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

func (*FileTypeQuery) Exist Uses

func (ftq *FileTypeQuery) Exist(ctx context.Context) (bool, error)

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

func (*FileTypeQuery) ExistX Uses

func (ftq *FileTypeQuery) ExistX(ctx context.Context) bool

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

func (*FileTypeQuery) First Uses

func (ftq *FileTypeQuery) First(ctx context.Context) (*FileType, error)

First returns the first FileType entity in the query. Returns *ErrNotFound when no filetype was found.

func (*FileTypeQuery) FirstID Uses

func (ftq *FileTypeQuery) FirstID(ctx context.Context) (id string, err error)

FirstID returns the first FileType id in the query. Returns *ErrNotFound when no id was found.

func (*FileTypeQuery) FirstX Uses

func (ftq *FileTypeQuery) FirstX(ctx context.Context) *FileType

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

func (*FileTypeQuery) FirstXID Uses

func (ftq *FileTypeQuery) FirstXID(ctx context.Context) string

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

func (*FileTypeQuery) GroupBy Uses

func (ftq *FileTypeQuery) GroupBy(field string, fields ...string) *FileTypeGroupBy

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

client.FileType.Query().
	GroupBy(filetype.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*FileTypeQuery) IDs Uses

func (ftq *FileTypeQuery) IDs(ctx context.Context) ([]string, error)

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

func (*FileTypeQuery) IDsX Uses

func (ftq *FileTypeQuery) IDsX(ctx context.Context) []string

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

func (*FileTypeQuery) Limit Uses

func (ftq *FileTypeQuery) Limit(limit int) *FileTypeQuery

Limit adds a limit step to the query.

func (*FileTypeQuery) Offset Uses

func (ftq *FileTypeQuery) Offset(offset int) *FileTypeQuery

Offset adds an offset step to the query.

func (*FileTypeQuery) Only Uses

func (ftq *FileTypeQuery) Only(ctx context.Context) (*FileType, error)

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

func (*FileTypeQuery) OnlyID Uses

func (ftq *FileTypeQuery) OnlyID(ctx context.Context) (id string, err error)

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

func (*FileTypeQuery) OnlyX Uses

func (ftq *FileTypeQuery) OnlyX(ctx context.Context) *FileType

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

func (*FileTypeQuery) OnlyXID Uses

func (ftq *FileTypeQuery) OnlyXID(ctx context.Context) string

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

func (*FileTypeQuery) Order Uses

func (ftq *FileTypeQuery) Order(o ...Order) *FileTypeQuery

Order adds an order step to the query.

func (*FileTypeQuery) QueryFiles Uses

func (ftq *FileTypeQuery) QueryFiles() *FileQuery

QueryFiles chains the current query on the files edge.

func (*FileTypeQuery) Select Uses

func (ftq *FileTypeQuery) Select(field string, fields ...string) *FileTypeSelect

Select one or more fields from the given query.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
}

client.FileType.Query().
	Select(filetype.FieldName).
	Scan(ctx, &v)

func (*FileTypeQuery) Where Uses

func (ftq *FileTypeQuery) Where(ps ...predicate.FileType) *FileTypeQuery

Where adds a new predicate for the builder.

type FileTypeSelect Uses

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

FileTypeSelect is the builder for select fields of FileType entities.

func (*FileTypeSelect) Bools Uses

func (fts *FileTypeSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*FileTypeSelect) BoolsX Uses

func (fts *FileTypeSelect) BoolsX(ctx context.Context) []bool

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

func (*FileTypeSelect) Float64s Uses

func (fts *FileTypeSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*FileTypeSelect) Float64sX Uses

func (fts *FileTypeSelect) Float64sX(ctx context.Context) []float64

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

func (*FileTypeSelect) Ints Uses

func (fts *FileTypeSelect) Ints(ctx context.Context) ([]int, error)

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

func (*FileTypeSelect) IntsX Uses

func (fts *FileTypeSelect) IntsX(ctx context.Context) []int

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

func (*FileTypeSelect) Scan Uses

func (fts *FileTypeSelect) Scan(ctx context.Context, v interface{}) error

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

func (*FileTypeSelect) ScanX Uses

func (fts *FileTypeSelect) ScanX(ctx context.Context, v interface{})

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

func (*FileTypeSelect) Strings Uses

func (fts *FileTypeSelect) Strings(ctx context.Context) ([]string, error)

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

func (*FileTypeSelect) StringsX Uses

func (fts *FileTypeSelect) StringsX(ctx context.Context) []string

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

type FileTypeUpdate Uses

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

FileTypeUpdate is the builder for updating FileType entities.

func (*FileTypeUpdate) AddFileIDs Uses

func (ftu *FileTypeUpdate) AddFileIDs(ids ...string) *FileTypeUpdate

AddFileIDs adds the files edge to File by ids.

func (*FileTypeUpdate) AddFiles Uses

func (ftu *FileTypeUpdate) AddFiles(f ...*File) *FileTypeUpdate

AddFiles adds the files edges to File.

func (*FileTypeUpdate) Exec Uses

func (ftu *FileTypeUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*FileTypeUpdate) ExecX Uses

func (ftu *FileTypeUpdate) ExecX(ctx context.Context)

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

func (*FileTypeUpdate) RemoveFileIDs Uses

func (ftu *FileTypeUpdate) RemoveFileIDs(ids ...string) *FileTypeUpdate

RemoveFileIDs removes the files edge to File by ids.

func (*FileTypeUpdate) RemoveFiles Uses

func (ftu *FileTypeUpdate) RemoveFiles(f ...*File) *FileTypeUpdate

RemoveFiles removes files edges to File.

func (*FileTypeUpdate) Save Uses

func (ftu *FileTypeUpdate) Save(ctx context.Context) (int, error)

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

func (*FileTypeUpdate) SaveX Uses

func (ftu *FileTypeUpdate) SaveX(ctx context.Context) int

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

func (*FileTypeUpdate) SetName Uses

func (ftu *FileTypeUpdate) SetName(s string) *FileTypeUpdate

SetName sets the name field.

func (*FileTypeUpdate) Where Uses

func (ftu *FileTypeUpdate) Where(ps ...predicate.FileType) *FileTypeUpdate

Where adds a new predicate for the builder.

type FileTypeUpdateOne Uses

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

FileTypeUpdateOne is the builder for updating a single FileType entity.

func (*FileTypeUpdateOne) AddFileIDs Uses

func (ftuo *FileTypeUpdateOne) AddFileIDs(ids ...string) *FileTypeUpdateOne

AddFileIDs adds the files edge to File by ids.

func (*FileTypeUpdateOne) AddFiles Uses

func (ftuo *FileTypeUpdateOne) AddFiles(f ...*File) *FileTypeUpdateOne

AddFiles adds the files edges to File.

func (*FileTypeUpdateOne) Exec Uses

func (ftuo *FileTypeUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*FileTypeUpdateOne) ExecX Uses

func (ftuo *FileTypeUpdateOne) ExecX(ctx context.Context)

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

func (*FileTypeUpdateOne) RemoveFileIDs Uses

func (ftuo *FileTypeUpdateOne) RemoveFileIDs(ids ...string) *FileTypeUpdateOne

RemoveFileIDs removes the files edge to File by ids.

func (*FileTypeUpdateOne) RemoveFiles Uses

func (ftuo *FileTypeUpdateOne) RemoveFiles(f ...*File) *FileTypeUpdateOne

RemoveFiles removes files edges to File.

func (*FileTypeUpdateOne) Save Uses

func (ftuo *FileTypeUpdateOne) Save(ctx context.Context) (*FileType, error)

Save executes the query and returns the updated entity.

func (*FileTypeUpdateOne) SaveX Uses

func (ftuo *FileTypeUpdateOne) SaveX(ctx context.Context) *FileType

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

func (*FileTypeUpdateOne) SetName Uses

func (ftuo *FileTypeUpdateOne) SetName(s string) *FileTypeUpdateOne

SetName sets the name field.

type FileTypes Uses

type FileTypes []*FileType

FileTypes is a parsable slice of FileType.

func (*FileTypes) FromResponse Uses

func (ft *FileTypes) FromResponse(res *gremlin.Response) error

FromResponse scans the gremlin response data into FileTypes.

func (*FileTypes) FromRows Uses

func (ft *FileTypes) FromRows(rows *sql.Rows) error

FromRows scans the sql response data into FileTypes.

type FileUpdate Uses

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

FileUpdate is the builder for updating File entities.

func (*FileUpdate) AddSize Uses

func (fu *FileUpdate) AddSize(i int) *FileUpdate

AddSize adds i to size.

func (*FileUpdate) ClearGroup Uses

func (fu *FileUpdate) ClearGroup() *FileUpdate

ClearGroup clears the value of group.

func (*FileUpdate) ClearOwner Uses

func (fu *FileUpdate) ClearOwner() *FileUpdate

ClearOwner clears the owner edge to User.

func (*FileUpdate) ClearType Uses

func (fu *FileUpdate) ClearType() *FileUpdate

ClearType clears the type edge to FileType.

func (*FileUpdate) ClearUser Uses

func (fu *FileUpdate) ClearUser() *FileUpdate

ClearUser clears the value of user.

func (*FileUpdate) Exec Uses

func (fu *FileUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*FileUpdate) ExecX Uses

func (fu *FileUpdate) ExecX(ctx context.Context)

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

func (*FileUpdate) Save Uses

func (fu *FileUpdate) Save(ctx context.Context) (int, error)

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

func (*FileUpdate) SaveX Uses

func (fu *FileUpdate) SaveX(ctx context.Context) int

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

func (*FileUpdate) SetGroup Uses

func (fu *FileUpdate) SetGroup(s string) *FileUpdate

SetGroup sets the group field.

func (*FileUpdate) SetName Uses

func (fu *FileUpdate) SetName(s string) *FileUpdate

SetName sets the name field.

func (*FileUpdate) SetNillableGroup Uses

func (fu *FileUpdate) SetNillableGroup(s *string) *FileUpdate

SetNillableGroup sets the group field if the given value is not nil.

func (*FileUpdate) SetNillableOwnerID Uses

func (fu *FileUpdate) SetNillableOwnerID(id *string) *FileUpdate

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

func (*FileUpdate) SetNillableSize Uses

func (fu *FileUpdate) SetNillableSize(i *int) *FileUpdate

SetNillableSize sets the size field if the given value is not nil.

func (*FileUpdate) SetNillableTypeID Uses

func (fu *FileUpdate) SetNillableTypeID(id *string) *FileUpdate

SetNillableTypeID sets the type edge to FileType by id if the given value is not nil.

func (*FileUpdate) SetNillableUser Uses

func (fu *FileUpdate) SetNillableUser(s *string) *FileUpdate

SetNillableUser sets the user field if the given value is not nil.

func (*FileUpdate) SetOwner Uses

func (fu *FileUpdate) SetOwner(u *User) *FileUpdate

SetOwner sets the owner edge to User.

func (*FileUpdate) SetOwnerID Uses

func (fu *FileUpdate) SetOwnerID(id string) *FileUpdate

SetOwnerID sets the owner edge to User by id.

func (*FileUpdate) SetSize Uses

func (fu *FileUpdate) SetSize(i int) *FileUpdate

SetSize sets the size field.

func (*FileUpdate) SetType Uses

func (fu *FileUpdate) SetType(f *FileType) *FileUpdate

SetType sets the type edge to FileType.

func (*FileUpdate) SetTypeID Uses

func (fu *FileUpdate) SetTypeID(id string) *FileUpdate

SetTypeID sets the type edge to FileType by id.

func (*FileUpdate) SetUser Uses

func (fu *FileUpdate) SetUser(s string) *FileUpdate

SetUser sets the user field.

func (*FileUpdate) Where Uses

func (fu *FileUpdate) Where(ps ...predicate.File) *FileUpdate

Where adds a new predicate for the builder.

type FileUpdateOne Uses

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

FileUpdateOne is the builder for updating a single File entity.

func (*FileUpdateOne) AddSize Uses

func (fuo *FileUpdateOne) AddSize(i int) *FileUpdateOne

AddSize adds i to size.

func (*FileUpdateOne) ClearGroup Uses

func (fuo *FileUpdateOne) ClearGroup() *FileUpdateOne

ClearGroup clears the value of group.

func (*FileUpdateOne) ClearOwner Uses

func (fuo *FileUpdateOne) ClearOwner() *FileUpdateOne

ClearOwner clears the owner edge to User.

func (*FileUpdateOne) ClearType Uses

func (fuo *FileUpdateOne) ClearType() *FileUpdateOne

ClearType clears the type edge to FileType.

func (*FileUpdateOne) ClearUser Uses

func (fuo *FileUpdateOne) ClearUser() *FileUpdateOne

ClearUser clears the value of user.

func (*FileUpdateOne) Exec Uses

func (fuo *FileUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*FileUpdateOne) ExecX Uses

func (fuo *FileUpdateOne) ExecX(ctx context.Context)

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

func (*FileUpdateOne) Save Uses

func (fuo *FileUpdateOne) Save(ctx context.Context) (*File, error)

Save executes the query and returns the updated entity.

func (*FileUpdateOne) SaveX Uses

func (fuo *FileUpdateOne) SaveX(ctx context.Context) *File

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

func (*FileUpdateOne) SetGroup Uses

func (fuo *FileUpdateOne) SetGroup(s string) *FileUpdateOne

SetGroup sets the group field.

func (*FileUpdateOne) SetName Uses

func (fuo *FileUpdateOne) SetName(s string) *FileUpdateOne

SetName sets the name field.

func (*FileUpdateOne) SetNillableGroup Uses

func (fuo *FileUpdateOne) SetNillableGroup(s *string) *FileUpdateOne

SetNillableGroup sets the group field if the given value is not nil.

func (*FileUpdateOne) SetNillableOwnerID Uses

func (fuo *FileUpdateOne) SetNillableOwnerID(id *string) *FileUpdateOne

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

func (*FileUpdateOne) SetNillableSize Uses

func (fuo *FileUpdateOne) SetNillableSize(i *int) *FileUpdateOne

SetNillableSize sets the size field if the given value is not nil.

func (*FileUpdateOne) SetNillableTypeID Uses

func (fuo *FileUpdateOne) SetNillableTypeID(id *string) *FileUpdateOne

SetNillableTypeID sets the type edge to FileType by id if the given value is not nil.

func (*FileUpdateOne) SetNillableUser Uses

func (fuo *FileUpdateOne) SetNillableUser(s *string) *FileUpdateOne

SetNillableUser sets the user field if the given value is not nil.

func (*FileUpdateOne) SetOwner Uses

func (fuo *FileUpdateOne) SetOwner(u *User) *FileUpdateOne

SetOwner sets the owner edge to User.

func (*FileUpdateOne) SetOwnerID Uses

func (fuo *FileUpdateOne) SetOwnerID(id string) *FileUpdateOne

SetOwnerID sets the owner edge to User by id.

func (*FileUpdateOne) SetSize Uses

func (fuo *FileUpdateOne) SetSize(i int) *FileUpdateOne

SetSize sets the size field.

func (*FileUpdateOne) SetType Uses

func (fuo *FileUpdateOne) SetType(f *FileType) *FileUpdateOne

SetType sets the type edge to FileType.

func (*FileUpdateOne) SetTypeID Uses

func (fuo *FileUpdateOne) SetTypeID(id string) *FileUpdateOne

SetTypeID sets the type edge to FileType by id.

func (*FileUpdateOne) SetUser Uses

func (fuo *FileUpdateOne) SetUser(s string) *FileUpdateOne

SetUser sets the user field.

type Files Uses

type Files []*File

Files is a parsable slice of File.

func (*Files) FromResponse Uses

func (f *Files) FromResponse(res *gremlin.Response) error

FromResponse scans the gremlin response data into Files.

func (*Files) FromRows Uses

func (f *Files) FromRows(rows *sql.Rows) error

FromRows scans the sql response data into Files.

type Group Uses

type Group struct {

    // ID of the ent.
    ID  string `json:"id,omitempty"`
    // Active holds the value of the "active" field.
    Active bool `json:"active,omitempty"`
    // Expire holds the value of the "expire" field.
    Expire time.Time `json:"expire,omitempty"`
    // Type holds the value of the "type" field.
    Type *string `json:"type,omitempty"`
    // MaxUsers holds the value of the "max_users" field.
    MaxUsers int `json:"max_users,omitempty"`
    // Name holds the value of the "name" field.
    Name string `json:"name,omitempty"`
    // contains filtered or unexported fields
}

Group is the model entity for the Group schema.

Code:

if dsn == "" {
    return
}
ctx := context.Background()
drv, err := sql.Open("mysql", dsn)
if err != nil {
    log.Fatalf("failed creating database client: %v", err)
}
defer drv.Close()
client := NewClient(Driver(drv))
// creating vertices for the group's edges.
f0 := client.File.
    Create().
    SetSize(1).
    SetName("string").
    SetUser("string").
    SetGroup("string").
    SaveX(ctx)
log.Println("file created:", f0)
u1 := client.User.
    Create().
    SetAge(1).
    SetName("string").
    SetLast("string").
    SetNickname("string").
    SetPhone("string").
    SetPassword("string").
    SaveX(ctx)
log.Println("user created:", u1)
gi3 := client.GroupInfo.
    Create().
    SetDesc("string").
    SetMaxUsers(1).
    SaveX(ctx)
log.Println("groupinfo created:", gi3)

// create group vertex with its edges.
gr := client.Group.
    Create().
    SetActive(true).
    SetExpire(time.Now()).
    SetType("string").
    SetMaxUsers(1).
    SetName("string").
    AddFiles(f0).
    AddBlocked(u1).
    SetInfo(gi3).
    SaveX(ctx)
log.Println("group created:", gr)

// query edges.
f0, err = gr.QueryFiles().First(ctx)
if err != nil {
    log.Fatalf("failed querying files: %v", err)
}
log.Println("files found:", f0)

u1, err = gr.QueryBlocked().First(ctx)
if err != nil {
    log.Fatalf("failed querying blocked: %v", err)
}
log.Println("blocked found:", u1)

gi3, err = gr.QueryInfo().First(ctx)
if err != nil {
    log.Fatalf("failed querying info: %v", err)
}
log.Println("info found:", gi3)

func (*Group) FromResponse Uses

func (gr *Group) FromResponse(res *gremlin.Response) error

FromResponse scans the gremlin response data into Group.

func (*Group) FromRows Uses

func (gr *Group) FromRows(rows *sql.Rows) error

FromRows scans the sql response data into Group.

func (*Group) QueryBlocked Uses

func (gr *Group) QueryBlocked() *UserQuery

QueryBlocked queries the blocked edge of the Group.

func (*Group) QueryFiles Uses

func (gr *Group) QueryFiles() *FileQuery

QueryFiles queries the files edge of the Group.

func (*Group) QueryInfo Uses

func (gr *Group) QueryInfo() *GroupInfoQuery

QueryInfo queries the info edge of the Group.

func (*Group) QueryUsers Uses

func (gr *Group) QueryUsers() *UserQuery

QueryUsers queries the users edge of the Group.

func (*Group) String Uses

func (gr *Group) String() string

String implements the fmt.Stringer.

func (*Group) Unwrap Uses

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 Uses

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 Uses

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

GroupClient is a client for the Group schema.

func NewGroupClient Uses

func NewGroupClient(c config) *GroupClient

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

func (*GroupClient) Create Uses

func (c *GroupClient) Create() *GroupCreate

Create returns a create builder for Group.

func (*GroupClient) Delete Uses

func (c *GroupClient) Delete() *GroupDelete

Delete returns a delete builder for Group.

func (*GroupClient) DeleteOne Uses

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

DeleteOne returns a delete builder for the given entity.

func (*GroupClient) DeleteOneID Uses

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

DeleteOneID returns a delete builder for the given id.

func (*GroupClient) Get Uses

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

Get returns a Group entity by its id.

func (*GroupClient) GetX Uses

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

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

func (*GroupClient) Query Uses

func (c *GroupClient) Query() *GroupQuery

Create returns a query builder for Group.

func (*GroupClient) QueryBlocked Uses

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

QueryBlocked queries the blocked edge of a Group.

func (*GroupClient) QueryFiles Uses

func (c *GroupClient) QueryFiles(gr *Group) *FileQuery

QueryFiles queries the files edge of a Group.

func (*GroupClient) QueryInfo Uses

func (c *GroupClient) QueryInfo(gr *Group) *GroupInfoQuery

QueryInfo queries the info edge of a Group.

func (*GroupClient) QueryUsers Uses

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

QueryUsers queries the users edge of a Group.

func (*GroupClient) Update Uses

func (c *GroupClient) Update() *GroupUpdate

Update returns an update builder for Group.

func (*GroupClient) UpdateOne Uses

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

UpdateOne returns an update builder for the given entity.

func (*GroupClient) UpdateOneID Uses

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

UpdateOneID returns an update builder for the given id.

type GroupCreate Uses

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

GroupCreate is the builder for creating a Group entity.

func (*GroupCreate) AddBlocked Uses

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

AddBlocked adds the blocked edges to User.

func (*GroupCreate) AddBlockedIDs Uses

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

AddBlockedIDs adds the blocked edge to User by ids.

func (*GroupCreate) AddFileIDs Uses

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

AddFileIDs adds the files edge to File by ids.

func (*GroupCreate) AddFiles Uses

func (gc *GroupCreate) AddFiles(f ...*File) *GroupCreate

AddFiles adds the files edges to File.

func (*GroupCreate) AddUserIDs Uses

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

AddUserIDs adds the users edge to User by ids.

func (*GroupCreate) AddUsers Uses

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

AddUsers adds the users edges to User.

func (*GroupCreate) Save Uses

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

Save creates the Group in the database.

func (*GroupCreate) SaveX Uses

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

SaveX calls Save and panics if Save returns an error.

func (*GroupCreate) SetActive Uses

func (gc *GroupCreate) SetActive(b bool) *GroupCreate

SetActive sets the active field.

func (*GroupCreate) SetExpire Uses

func (gc *GroupCreate) SetExpire(t time.Time) *GroupCreate

SetExpire sets the expire field.

func (*GroupCreate) SetInfo Uses

func (gc *GroupCreate) SetInfo(g *GroupInfo) *GroupCreate

SetInfo sets the info edge to GroupInfo.

func (*GroupCreate) SetInfoID Uses

func (gc *GroupCreate) SetInfoID(id string) *GroupCreate

SetInfoID sets the info edge to GroupInfo by id.

func (*GroupCreate) SetMaxUsers Uses

func (gc *GroupCreate) SetMaxUsers(i int) *GroupCreate

SetMaxUsers sets the max_users field.

func (*GroupCreate) SetName Uses

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

SetName sets the name field.

func (*GroupCreate) SetNillableActive Uses

func (gc *GroupCreate) SetNillableActive(b *bool) *GroupCreate

SetNillableActive sets the active field if the given value is not nil.

func (*GroupCreate) SetNillableMaxUsers Uses

func (gc *GroupCreate) SetNillableMaxUsers(i *int) *GroupCreate

SetNillableMaxUsers sets the max_users field if the given value is not nil.

func (*GroupCreate) SetNillableType Uses

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

SetNillableType sets the type field if the given value is not nil.

func (*GroupCreate) SetType Uses

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

SetType sets the type field.

type GroupDelete Uses

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

GroupDelete is the builder for deleting a Group entity.

func (*GroupDelete) Exec Uses

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

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

func (*GroupDelete) ExecX Uses

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

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

func (*GroupDelete) Where Uses

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

Where adds a new predicate to the delete builder.

type GroupDeleteOne Uses

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

GroupDeleteOne is the builder for deleting a single Group entity.

func (*GroupDeleteOne) Exec Uses

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

Exec executes the deletion query.

func (*GroupDeleteOne) ExecX Uses

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

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

type GroupGroupBy Uses

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

GroupGroupBy is the builder for group-by Group entities.

func (*GroupGroupBy) Aggregate Uses

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

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

func (*GroupGroupBy) Bools Uses

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 Uses

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

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

func (*GroupGroupBy) Float64s Uses

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 Uses

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

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

func (*GroupGroupBy) Ints Uses

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 Uses

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

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

func (*GroupGroupBy) Scan Uses

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 Uses

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

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

func (*GroupGroupBy) Strings Uses

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 Uses

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

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

type GroupInfo Uses

type GroupInfo struct {

    // ID of the ent.
    ID  string `json:"id,omitempty"`
    // Desc holds the value of the "desc" field.
    Desc string `json:"desc,omitempty"`
    // MaxUsers holds the value of the "max_users" field.
    MaxUsers int `json:"max_users,omitempty"`
    // contains filtered or unexported fields
}

GroupInfo is the model entity for the GroupInfo schema.

Code:

if dsn == "" {
    return
}
ctx := context.Background()
drv, err := sql.Open("mysql", dsn)
if err != nil {
    log.Fatalf("failed creating database client: %v", err)
}
defer drv.Close()
client := NewClient(Driver(drv))
// creating vertices for the groupinfo's edges.

// create groupinfo vertex with its edges.
gi := client.GroupInfo.
    Create().
    SetDesc("string").
    SetMaxUsers(1).
    SaveX(ctx)
log.Println("groupinfo created:", gi)

// query edges.

func (*GroupInfo) FromResponse Uses

func (gi *GroupInfo) FromResponse(res *gremlin.Response) error

FromResponse scans the gremlin response data into GroupInfo.

func (*GroupInfo) FromRows Uses

func (gi *GroupInfo) FromRows(rows *sql.Rows) error

FromRows scans the sql response data into GroupInfo.

func (*GroupInfo) QueryGroups Uses

func (gi *GroupInfo) QueryGroups() *GroupQuery

QueryGroups queries the groups edge of the GroupInfo.

func (*GroupInfo) String Uses

func (gi *GroupInfo) String() string

String implements the fmt.Stringer.

func (*GroupInfo) Unwrap Uses

func (gi *GroupInfo) Unwrap() *GroupInfo

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 (*GroupInfo) Update Uses

func (gi *GroupInfo) Update() *GroupInfoUpdateOne

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

type GroupInfoClient Uses

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

GroupInfoClient is a client for the GroupInfo schema.

func NewGroupInfoClient Uses

func NewGroupInfoClient(c config) *GroupInfoClient

NewGroupInfoClient returns a client for the GroupInfo from the given config.

func (*GroupInfoClient) Create Uses

func (c *GroupInfoClient) Create() *GroupInfoCreate

Create returns a create builder for GroupInfo.

func (*GroupInfoClient) Delete Uses

func (c *GroupInfoClient) Delete() *GroupInfoDelete

Delete returns a delete builder for GroupInfo.

func (*GroupInfoClient) DeleteOne Uses

func (c *GroupInfoClient) DeleteOne(gi *GroupInfo) *GroupInfoDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*GroupInfoClient) DeleteOneID Uses

func (c *GroupInfoClient) DeleteOneID(id string) *GroupInfoDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*GroupInfoClient) Get Uses

func (c *GroupInfoClient) Get(ctx context.Context, id string) (*GroupInfo, error)

Get returns a GroupInfo entity by its id.

func (*GroupInfoClient) GetX Uses

func (c *GroupInfoClient) GetX(ctx context.Context, id string) *GroupInfo

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

func (*GroupInfoClient) Query Uses

func (c *GroupInfoClient) Query() *GroupInfoQuery

Create returns a query builder for GroupInfo.

func (*GroupInfoClient) QueryGroups Uses

func (c *GroupInfoClient) QueryGroups(gi *GroupInfo) *GroupQuery

QueryGroups queries the groups edge of a GroupInfo.

func (*GroupInfoClient) Update Uses

func (c *GroupInfoClient) Update() *GroupInfoUpdate

Update returns an update builder for GroupInfo.

func (*GroupInfoClient) UpdateOne Uses

func (c *GroupInfoClient) UpdateOne(gi *GroupInfo) *GroupInfoUpdateOne

UpdateOne returns an update builder for the given entity.

func (*GroupInfoClient) UpdateOneID Uses

func (c *GroupInfoClient) UpdateOneID(id string) *GroupInfoUpdateOne

UpdateOneID returns an update builder for the given id.

type GroupInfoCreate Uses

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

GroupInfoCreate is the builder for creating a GroupInfo entity.

func (*GroupInfoCreate) AddGroupIDs Uses

func (gic *GroupInfoCreate) AddGroupIDs(ids ...string) *GroupInfoCreate

AddGroupIDs adds the groups edge to Group by ids.

func (*GroupInfoCreate) AddGroups Uses

func (gic *GroupInfoCreate) AddGroups(g ...*Group) *GroupInfoCreate

AddGroups adds the groups edges to Group.

func (*GroupInfoCreate) Save Uses

func (gic *GroupInfoCreate) Save(ctx context.Context) (*GroupInfo, error)

Save creates the GroupInfo in the database.

func (*GroupInfoCreate) SaveX Uses

func (gic *GroupInfoCreate) SaveX(ctx context.Context) *GroupInfo

SaveX calls Save and panics if Save returns an error.

func (*GroupInfoCreate) SetDesc Uses

func (gic *GroupInfoCreate) SetDesc(s string) *GroupInfoCreate

SetDesc sets the desc field.

func (*GroupInfoCreate) SetMaxUsers Uses

func (gic *GroupInfoCreate) SetMaxUsers(i int) *GroupInfoCreate

SetMaxUsers sets the max_users field.

func (*GroupInfoCreate) SetNillableMaxUsers Uses

func (gic *GroupInfoCreate) SetNillableMaxUsers(i *int) *GroupInfoCreate

SetNillableMaxUsers sets the max_users field if the given value is not nil.

type GroupInfoDelete Uses

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

GroupInfoDelete is the builder for deleting a GroupInfo entity.

func (*GroupInfoDelete) Exec Uses

func (gid *GroupInfoDelete) Exec(ctx context.Context) (int, error)

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

func (*GroupInfoDelete) ExecX Uses

func (gid *GroupInfoDelete) ExecX(ctx context.Context) int

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

func (*GroupInfoDelete) Where Uses

func (gid *GroupInfoDelete) Where(ps ...predicate.GroupInfo) *GroupInfoDelete

Where adds a new predicate to the delete builder.

type GroupInfoDeleteOne Uses

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

GroupInfoDeleteOne is the builder for deleting a single GroupInfo entity.

func (*GroupInfoDeleteOne) Exec Uses

func (gido *GroupInfoDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*GroupInfoDeleteOne) ExecX Uses

func (gido *GroupInfoDeleteOne) ExecX(ctx context.Context)

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

type GroupInfoGroupBy Uses

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

GroupInfoGroupBy is the builder for group-by GroupInfo entities.

func (*GroupInfoGroupBy) Aggregate Uses

func (gigb *GroupInfoGroupBy) Aggregate(fns ...Aggregate) *GroupInfoGroupBy

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

func (*GroupInfoGroupBy) Bools Uses

func (gigb *GroupInfoGroupBy) 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 (*GroupInfoGroupBy) BoolsX Uses

func (gigb *GroupInfoGroupBy) BoolsX(ctx context.Context) []bool

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

func (*GroupInfoGroupBy) Float64s Uses

func (gigb *GroupInfoGroupBy) 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 (*GroupInfoGroupBy) Float64sX Uses

func (gigb *GroupInfoGroupBy) Float64sX(ctx context.Context) []float64

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

func (*GroupInfoGroupBy) Ints Uses

func (gigb *GroupInfoGroupBy) 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 (*GroupInfoGroupBy) IntsX Uses

func (gigb *GroupInfoGroupBy) IntsX(ctx context.Context) []int

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

func (*GroupInfoGroupBy) Scan Uses

func (gigb *GroupInfoGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*GroupInfoGroupBy) ScanX Uses

func (gigb *GroupInfoGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*GroupInfoGroupBy) Strings Uses

func (gigb *GroupInfoGroupBy) 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 (*GroupInfoGroupBy) StringsX Uses

func (gigb *GroupInfoGroupBy) StringsX(ctx context.Context) []string

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

type GroupInfoQuery Uses

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

GroupInfoQuery is the builder for querying GroupInfo entities.

func (*GroupInfoQuery) All Uses

func (giq *GroupInfoQuery) All(ctx context.Context) ([]*GroupInfo, error)

All executes the query and returns a list of GroupInfos.

func (*GroupInfoQuery) AllX Uses

func (giq *GroupInfoQuery) AllX(ctx context.Context) []*GroupInfo

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

func (*GroupInfoQuery) Clone Uses

func (giq *GroupInfoQuery) Clone() *GroupInfoQuery

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 (*GroupInfoQuery) Count Uses

func (giq *GroupInfoQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*GroupInfoQuery) CountX Uses

func (giq *GroupInfoQuery) CountX(ctx context.Context) int

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

func (*GroupInfoQuery) Exist Uses

func (giq *GroupInfoQuery) Exist(ctx context.Context) (bool, error)

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

func (*GroupInfoQuery) ExistX