Documentation ¶
Index ¶
- func IsConstraintError(err error) bool
- func IsNotFound(err error) bool
- func IsNotLoaded(err error) bool
- func IsNotSingular(err error) bool
- func MaskNotFound(err error) error
- func NewContext(parent context.Context, c *Client) context.Context
- type Aggregate
- type Client
- type ConstraintError
- type Message
- type MessageClient
- func (c *MessageClient) Create() *MessageCreate
- func (c *MessageClient) Delete() *MessageDelete
- func (c *MessageClient) DeleteOne(m *Message) *MessageDeleteOne
- func (c *MessageClient) DeleteOneID(id int) *MessageDeleteOne
- func (c *MessageClient) Get(ctx context.Context, id int) (*Message, error)
- func (c *MessageClient) GetX(ctx context.Context, id int) *Message
- func (c *MessageClient) Query() *MessageQuery
- func (c *MessageClient) Update() *MessageUpdate
- func (c *MessageClient) UpdateOne(m *Message) *MessageUpdateOne
- func (c *MessageClient) UpdateOneID(id int) *MessageUpdateOne
- type MessageCreate
- func (mc *MessageCreate) Save(ctx context.Context) (*Message, error)
- func (mc *MessageCreate) SaveX(ctx context.Context) *Message
- func (mc *MessageCreate) SetCreatedAt(t time.Time) *MessageCreate
- func (mc *MessageCreate) SetNillableCreatedAt(t *time.Time) *MessageCreate
- func (mc *MessageCreate) SetNillableUpdatedAt(t *time.Time) *MessageCreate
- func (mc *MessageCreate) SetText(s string) *MessageCreate
- func (mc *MessageCreate) SetUID(s string) *MessageCreate
- func (mc *MessageCreate) SetUpdatedAt(t time.Time) *MessageCreate
- type MessageDelete
- type MessageDeleteOne
- type MessageGroupBy
- func (mgb *MessageGroupBy) Aggregate(fns ...Aggregate) *MessageGroupBy
- func (mgb *MessageGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (mgb *MessageGroupBy) BoolsX(ctx context.Context) []bool
- func (mgb *MessageGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (mgb *MessageGroupBy) Float64sX(ctx context.Context) []float64
- func (mgb *MessageGroupBy) Ints(ctx context.Context) ([]int, error)
- func (mgb *MessageGroupBy) IntsX(ctx context.Context) []int
- func (mgb *MessageGroupBy) Scan(ctx context.Context, v interface{}) error
- func (mgb *MessageGroupBy) ScanX(ctx context.Context, v interface{})
- func (mgb *MessageGroupBy) Strings(ctx context.Context) ([]string, error)
- func (mgb *MessageGroupBy) StringsX(ctx context.Context) []string
- type MessageQuery
- func (mq *MessageQuery) All(ctx context.Context) ([]*Message, error)
- func (mq *MessageQuery) AllX(ctx context.Context) []*Message
- func (mq *MessageQuery) Clone() *MessageQuery
- func (mq *MessageQuery) Count(ctx context.Context) (int, error)
- func (mq *MessageQuery) CountX(ctx context.Context) int
- func (mq *MessageQuery) Exist(ctx context.Context) (bool, error)
- func (mq *MessageQuery) ExistX(ctx context.Context) bool
- func (mq *MessageQuery) First(ctx context.Context) (*Message, error)
- func (mq *MessageQuery) FirstID(ctx context.Context) (id int, err error)
- func (mq *MessageQuery) FirstX(ctx context.Context) *Message
- func (mq *MessageQuery) FirstXID(ctx context.Context) int
- func (mq *MessageQuery) GroupBy(field string, fields ...string) *MessageGroupBy
- func (mq *MessageQuery) IDs(ctx context.Context) ([]int, error)
- func (mq *MessageQuery) IDsX(ctx context.Context) []int
- func (mq *MessageQuery) Limit(limit int) *MessageQuery
- func (mq *MessageQuery) Offset(offset int) *MessageQuery
- func (mq *MessageQuery) Only(ctx context.Context) (*Message, error)
- func (mq *MessageQuery) OnlyID(ctx context.Context) (id int, err error)
- func (mq *MessageQuery) OnlyX(ctx context.Context) *Message
- func (mq *MessageQuery) OnlyXID(ctx context.Context) int
- func (mq *MessageQuery) Order(o ...Order) *MessageQuery
- func (mq *MessageQuery) Select(field string, fields ...string) *MessageSelect
- func (mq *MessageQuery) Where(ps ...predicate.Message) *MessageQuery
- type MessageSelect
- func (ms *MessageSelect) Bools(ctx context.Context) ([]bool, error)
- func (ms *MessageSelect) BoolsX(ctx context.Context) []bool
- func (ms *MessageSelect) Float64s(ctx context.Context) ([]float64, error)
- func (ms *MessageSelect) Float64sX(ctx context.Context) []float64
- func (ms *MessageSelect) Ints(ctx context.Context) ([]int, error)
- func (ms *MessageSelect) IntsX(ctx context.Context) []int
- func (ms *MessageSelect) Scan(ctx context.Context, v interface{}) error
- func (ms *MessageSelect) ScanX(ctx context.Context, v interface{})
- func (ms *MessageSelect) Strings(ctx context.Context) ([]string, error)
- func (ms *MessageSelect) StringsX(ctx context.Context) []string
- type MessageUpdate
- func (mu *MessageUpdate) Exec(ctx context.Context) error
- func (mu *MessageUpdate) ExecX(ctx context.Context)
- func (mu *MessageUpdate) Save(ctx context.Context) (int, error)
- func (mu *MessageUpdate) SaveX(ctx context.Context) int
- func (mu *MessageUpdate) SetCreatedAt(t time.Time) *MessageUpdate
- func (mu *MessageUpdate) SetNillableCreatedAt(t *time.Time) *MessageUpdate
- func (mu *MessageUpdate) SetText(s string) *MessageUpdate
- func (mu *MessageUpdate) SetUpdatedAt(t time.Time) *MessageUpdate
- func (mu *MessageUpdate) Where(ps ...predicate.Message) *MessageUpdate
- type MessageUpdateOne
- func (muo *MessageUpdateOne) Exec(ctx context.Context) error
- func (muo *MessageUpdateOne) ExecX(ctx context.Context)
- func (muo *MessageUpdateOne) Save(ctx context.Context) (*Message, error)
- func (muo *MessageUpdateOne) SaveX(ctx context.Context) *Message
- func (muo *MessageUpdateOne) SetCreatedAt(t time.Time) *MessageUpdateOne
- func (muo *MessageUpdateOne) SetNillableCreatedAt(t *time.Time) *MessageUpdateOne
- func (muo *MessageUpdateOne) SetText(s string) *MessageUpdateOne
- func (muo *MessageUpdateOne) SetUpdatedAt(t time.Time) *MessageUpdateOne
- type Messages
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Option
- type Order
- type Tx
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsConstraintError ¶
IsConstraintError returns a boolean indicating whether the error is a constraint failure.
func IsNotFound ¶
IsNotFound returns a boolean indicating whether the error is a not found error.
func IsNotLoaded ¶
IsNotLoaded returns a boolean indicating whether the error is a not loaded error.
func IsNotSingular ¶
IsNotSingular returns a boolean indicating whether the error is a not singular error.
Types ¶
type Aggregate ¶
Aggregate applies an aggregation step on the group-by traversal/selector.
func As ¶
As is a pseudo aggregation function for renaming another other functions with custom names. For example:
GroupBy(field1, field2). Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")). Scan(ctx, &v)
type Client ¶
type Client struct { // Schema is the client for creating, migrating and dropping schema. Schema *migrate.Schema // Message is the client for interacting with the Message builders. Message *MessageClient // contains filtered or unexported fields }
Client is the client that holds all ent builders.
func FromContext ¶
FromContext returns the Client stored in a context, or nil if there isn't one.
func Open ¶
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.
type ConstraintError ¶
type ConstraintError struct {
// contains filtered or unexported fields
}
ConstraintError returns when trying to create/update one or more entities and one or more of their constraints failed. For example, violation of edge or field uniqueness.
func (ConstraintError) Error ¶
func (e ConstraintError) Error() string
Error implements the error interface.
func (*ConstraintError) Unwrap ¶
func (e *ConstraintError) Unwrap() error
Unwrap implements the errors.Wrapper interface.
type Message ¶
type Message struct { // ID of the ent. ID int `json:"id,omitempty"` // UID holds the value of the "uid" field. UID string `json:"uid,omitempty"` // Text holds the value of the "text" field. Text string `json:"text,omitempty"` // CreatedAt holds the value of the "created_at" field. CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. UpdatedAt time.Time `json:"updated_at,omitempty"` // contains filtered or unexported fields }
Message is the model entity for the Message schema.
Example ¶
// Code generated by entc, DO NOT EDIT. package main import ( "context" "log" "time" "github.com/facebookincubator/ent/dialect/sql" ) // dsn for the database. In order to run the tests locally, run the following command: // // ENT_INTEGRATION_ENDPOINT="root:pass@tcp(localhost:3306)/test?parseTime=True" go test -v var dsn string func main() { 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 message's edges. // create message vertex with its edges. m := client.Message. Create(). SetUID("string"). SetText("string"). SetCreatedAt(time.Now()). SetUpdatedAt(time.Now()). SaveX(ctx) log.Println("message created:", m) // query edges. }
Output:
func (*Message) Unwrap ¶
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 (*Message) Update ¶
func (m *Message) Update() *MessageUpdateOne
Update returns a builder for updating this Message. Note that, you need to call Message.Unwrap() before calling this method, if this Message was returned from a transaction, and the transaction was committed or rolled back.
type MessageClient ¶
type MessageClient struct {
// contains filtered or unexported fields
}
MessageClient is a client for the Message schema.
func NewMessageClient ¶
func NewMessageClient(c config) *MessageClient
NewMessageClient returns a client for the Message from the given config.
func (*MessageClient) Create ¶
func (c *MessageClient) Create() *MessageCreate
Create returns a create builder for Message.
func (*MessageClient) Delete ¶
func (c *MessageClient) Delete() *MessageDelete
Delete returns a delete builder for Message.
func (*MessageClient) DeleteOne ¶
func (c *MessageClient) DeleteOne(m *Message) *MessageDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*MessageClient) DeleteOneID ¶
func (c *MessageClient) DeleteOneID(id int) *MessageDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*MessageClient) GetX ¶
func (c *MessageClient) GetX(ctx context.Context, id int) *Message
GetX is like Get, but panics if an error occurs.
func (*MessageClient) Query ¶
func (c *MessageClient) Query() *MessageQuery
Create returns a query builder for Message.
func (*MessageClient) Update ¶
func (c *MessageClient) Update() *MessageUpdate
Update returns an update builder for Message.
func (*MessageClient) UpdateOne ¶
func (c *MessageClient) UpdateOne(m *Message) *MessageUpdateOne
UpdateOne returns an update builder for the given entity.
func (*MessageClient) UpdateOneID ¶
func (c *MessageClient) UpdateOneID(id int) *MessageUpdateOne
UpdateOneID returns an update builder for the given id.
type MessageCreate ¶
type MessageCreate struct {
// contains filtered or unexported fields
}
MessageCreate is the builder for creating a Message entity.
func (*MessageCreate) Save ¶
func (mc *MessageCreate) Save(ctx context.Context) (*Message, error)
Save creates the Message in the database.
func (*MessageCreate) SaveX ¶
func (mc *MessageCreate) SaveX(ctx context.Context) *Message
SaveX calls Save and panics if Save returns an error.
func (*MessageCreate) SetCreatedAt ¶
func (mc *MessageCreate) SetCreatedAt(t time.Time) *MessageCreate
SetCreatedAt sets the created_at field.
func (*MessageCreate) SetNillableCreatedAt ¶
func (mc *MessageCreate) SetNillableCreatedAt(t *time.Time) *MessageCreate
SetNillableCreatedAt sets the created_at field if the given value is not nil.
func (*MessageCreate) SetNillableUpdatedAt ¶
func (mc *MessageCreate) SetNillableUpdatedAt(t *time.Time) *MessageCreate
SetNillableUpdatedAt sets the updated_at field if the given value is not nil.
func (*MessageCreate) SetText ¶
func (mc *MessageCreate) SetText(s string) *MessageCreate
SetText sets the text field.
func (*MessageCreate) SetUID ¶
func (mc *MessageCreate) SetUID(s string) *MessageCreate
SetUID sets the uid field.
func (*MessageCreate) SetUpdatedAt ¶
func (mc *MessageCreate) SetUpdatedAt(t time.Time) *MessageCreate
SetUpdatedAt sets the updated_at field.
type MessageDelete ¶
type MessageDelete struct {
// contains filtered or unexported fields
}
MessageDelete is the builder for deleting a Message entity.
func (*MessageDelete) Exec ¶
func (md *MessageDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*MessageDelete) ExecX ¶
func (md *MessageDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*MessageDelete) Where ¶
func (md *MessageDelete) Where(ps ...predicate.Message) *MessageDelete
Where adds a new predicate to the delete builder.
type MessageDeleteOne ¶
type MessageDeleteOne struct {
// contains filtered or unexported fields
}
MessageDeleteOne is the builder for deleting a single Message entity.
func (*MessageDeleteOne) Exec ¶
func (mdo *MessageDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*MessageDeleteOne) ExecX ¶
func (mdo *MessageDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type MessageGroupBy ¶
type MessageGroupBy struct {
// contains filtered or unexported fields
}
MessageGroupBy is the builder for group-by Message entities.
func (*MessageGroupBy) Aggregate ¶
func (mgb *MessageGroupBy) Aggregate(fns ...Aggregate) *MessageGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*MessageGroupBy) Bools ¶
func (mgb *MessageGroupBy) 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 (*MessageGroupBy) BoolsX ¶
func (mgb *MessageGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*MessageGroupBy) Float64s ¶
func (mgb *MessageGroupBy) 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 (*MessageGroupBy) Float64sX ¶
func (mgb *MessageGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*MessageGroupBy) Ints ¶
func (mgb *MessageGroupBy) 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 (*MessageGroupBy) IntsX ¶
func (mgb *MessageGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*MessageGroupBy) Scan ¶
func (mgb *MessageGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scan the result into the given value.
func (*MessageGroupBy) ScanX ¶
func (mgb *MessageGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
type MessageQuery ¶
type MessageQuery struct {
// contains filtered or unexported fields
}
MessageQuery is the builder for querying Message entities.
func (*MessageQuery) All ¶
func (mq *MessageQuery) All(ctx context.Context) ([]*Message, error)
All executes the query and returns a list of Messages.
func (*MessageQuery) AllX ¶
func (mq *MessageQuery) AllX(ctx context.Context) []*Message
AllX is like All, but panics if an error occurs.
func (*MessageQuery) Clone ¶
func (mq *MessageQuery) Clone() *MessageQuery
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 (*MessageQuery) Count ¶
func (mq *MessageQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*MessageQuery) CountX ¶
func (mq *MessageQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*MessageQuery) Exist ¶
func (mq *MessageQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*MessageQuery) ExistX ¶
func (mq *MessageQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*MessageQuery) First ¶
func (mq *MessageQuery) First(ctx context.Context) (*Message, error)
First returns the first Message entity in the query. Returns *NotFoundError when no message was found.
func (*MessageQuery) FirstID ¶
func (mq *MessageQuery) FirstID(ctx context.Context) (id int, err error)
FirstID returns the first Message id in the query. Returns *NotFoundError when no id was found.
func (*MessageQuery) FirstX ¶
func (mq *MessageQuery) FirstX(ctx context.Context) *Message
FirstX is like First, but panics if an error occurs.
func (*MessageQuery) FirstXID ¶
func (mq *MessageQuery) FirstXID(ctx context.Context) int
FirstXID is like FirstID, but panics if an error occurs.
func (*MessageQuery) GroupBy ¶
func (mq *MessageQuery) GroupBy(field string, fields ...string) *MessageGroupBy
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 { UID string `json:"uid,omitempty"` Count int `json:"count,omitempty"` } client.Message.Query(). GroupBy(message.FieldUID). Aggregate(ent.Count()). Scan(ctx, &v)
func (*MessageQuery) IDs ¶
func (mq *MessageQuery) IDs(ctx context.Context) ([]int, error)
IDs executes the query and returns a list of Message ids.
func (*MessageQuery) IDsX ¶
func (mq *MessageQuery) IDsX(ctx context.Context) []int
IDsX is like IDs, but panics if an error occurs.
func (*MessageQuery) Limit ¶
func (mq *MessageQuery) Limit(limit int) *MessageQuery
Limit adds a limit step to the query.
func (*MessageQuery) Offset ¶
func (mq *MessageQuery) Offset(offset int) *MessageQuery
Offset adds an offset step to the query.
func (*MessageQuery) Only ¶
func (mq *MessageQuery) Only(ctx context.Context) (*Message, error)
Only returns the only Message entity in the query, returns an error if not exactly one entity was returned.
func (*MessageQuery) OnlyID ¶
func (mq *MessageQuery) OnlyID(ctx context.Context) (id int, err error)
OnlyID returns the only Message id in the query, returns an error if not exactly one id was returned.
func (*MessageQuery) OnlyX ¶
func (mq *MessageQuery) OnlyX(ctx context.Context) *Message
OnlyX is like Only, but panics if an error occurs.
func (*MessageQuery) OnlyXID ¶
func (mq *MessageQuery) OnlyXID(ctx context.Context) int
OnlyXID is like OnlyID, but panics if an error occurs.
func (*MessageQuery) Order ¶
func (mq *MessageQuery) Order(o ...Order) *MessageQuery
Order adds an order step to the query.
func (*MessageQuery) Select ¶
func (mq *MessageQuery) Select(field string, fields ...string) *MessageSelect
Select one or more fields from the given query.
Example:
var v []struct { UID string `json:"uid,omitempty"` } client.Message.Query(). Select(message.FieldUID). Scan(ctx, &v)
func (*MessageQuery) Where ¶
func (mq *MessageQuery) Where(ps ...predicate.Message) *MessageQuery
Where adds a new predicate for the builder.
type MessageSelect ¶
type MessageSelect struct {
// contains filtered or unexported fields
}
MessageSelect is the builder for select fields of Message entities.
func (*MessageSelect) Bools ¶
func (ms *MessageSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from selector. It is only allowed when selecting one field.
func (*MessageSelect) BoolsX ¶
func (ms *MessageSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*MessageSelect) Float64s ¶
func (ms *MessageSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from selector. It is only allowed when selecting one field.
func (*MessageSelect) Float64sX ¶
func (ms *MessageSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*MessageSelect) Ints ¶
func (ms *MessageSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from selector. It is only allowed when selecting one field.
func (*MessageSelect) IntsX ¶
func (ms *MessageSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*MessageSelect) Scan ¶
func (ms *MessageSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scan the result into the given value.
func (*MessageSelect) ScanX ¶
func (ms *MessageSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
type MessageUpdate ¶
type MessageUpdate struct {
// contains filtered or unexported fields
}
MessageUpdate is the builder for updating Message entities.
func (*MessageUpdate) Exec ¶
func (mu *MessageUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*MessageUpdate) ExecX ¶
func (mu *MessageUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*MessageUpdate) Save ¶
func (mu *MessageUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of rows/vertices matched by this operation.
func (*MessageUpdate) SaveX ¶
func (mu *MessageUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*MessageUpdate) SetCreatedAt ¶
func (mu *MessageUpdate) SetCreatedAt(t time.Time) *MessageUpdate
SetCreatedAt sets the created_at field.
func (*MessageUpdate) SetNillableCreatedAt ¶
func (mu *MessageUpdate) SetNillableCreatedAt(t *time.Time) *MessageUpdate
SetNillableCreatedAt sets the created_at field if the given value is not nil.
func (*MessageUpdate) SetText ¶
func (mu *MessageUpdate) SetText(s string) *MessageUpdate
SetText sets the text field.
func (*MessageUpdate) SetUpdatedAt ¶
func (mu *MessageUpdate) SetUpdatedAt(t time.Time) *MessageUpdate
SetUpdatedAt sets the updated_at field.
func (*MessageUpdate) Where ¶
func (mu *MessageUpdate) Where(ps ...predicate.Message) *MessageUpdate
Where adds a new predicate for the builder.
type MessageUpdateOne ¶
type MessageUpdateOne struct {
// contains filtered or unexported fields
}
MessageUpdateOne is the builder for updating a single Message entity.
func (*MessageUpdateOne) Exec ¶
func (muo *MessageUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*MessageUpdateOne) ExecX ¶
func (muo *MessageUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*MessageUpdateOne) Save ¶
func (muo *MessageUpdateOne) Save(ctx context.Context) (*Message, error)
Save executes the query and returns the updated entity.
func (*MessageUpdateOne) SaveX ¶
func (muo *MessageUpdateOne) SaveX(ctx context.Context) *Message
SaveX is like Save, but panics if an error occurs.
func (*MessageUpdateOne) SetCreatedAt ¶
func (muo *MessageUpdateOne) SetCreatedAt(t time.Time) *MessageUpdateOne
SetCreatedAt sets the created_at field.
func (*MessageUpdateOne) SetNillableCreatedAt ¶
func (muo *MessageUpdateOne) SetNillableCreatedAt(t *time.Time) *MessageUpdateOne
SetNillableCreatedAt sets the created_at field if the given value is not nil.
func (*MessageUpdateOne) SetText ¶
func (muo *MessageUpdateOne) SetText(s string) *MessageUpdateOne
SetText sets the text field.
func (*MessageUpdateOne) SetUpdatedAt ¶
func (muo *MessageUpdateOne) SetUpdatedAt(t time.Time) *MessageUpdateOne
SetUpdatedAt sets the updated_at field.
type NotFoundError ¶
type NotFoundError struct {
// contains filtered or unexported fields
}
NotFoundError returns when trying to fetch a specific entity and it was not found in the database.
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
Error implements the error interface.
type NotLoadedError ¶
type NotLoadedError struct {
// contains filtered or unexported fields
}
NotLoadedError returns when trying to get a node that was not loaded by the query.
func (*NotLoadedError) Error ¶
func (e *NotLoadedError) Error() string
Error implements the error interface.
type NotSingularError ¶
type NotSingularError struct {
// contains filtered or unexported fields
}
NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.
func (*NotSingularError) Error ¶
func (e *NotSingularError) Error() string
Error implements the error interface.
type Tx ¶
type Tx struct { // Message is the client for interacting with the Message builders. Message *MessageClient // contains filtered or unexported fields }
Tx is a transactional client that is created by calling Client.Tx().