ent

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2020 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

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

	// Node types.
	TypeRobotstxt = "Robotstxt"
)

Variables

This section is empty.

Functions

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks nor found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

Types

type Aggregate

type Aggregate func(*sql.Selector) string

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

func As

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

func Count() Aggregate

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

func Max

func Max(field string) Aggregate

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

func Mean

func Mean(field string) Aggregate

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

func Min

func Min(field string) Aggregate

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

func Sum

func Sum(field string) Aggregate

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

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Robotstxt is the client for interacting with the Robotstxt builders.
	Robotstxt *RobotstxtClient
	// contains filtered or unexported fields
}

Client is the client that holds all ent builders.

func FromContext

func FromContext(ctx context.Context) *Client

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

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new client configured with the given options.

func Open

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

Open opens a 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

func (c *Client) Close() error

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

func (*Client) Debug

func (c *Client) Debug() *Client

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

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

func (*Client) Tx

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

Tx returns a new transactional client.

func (*Client) Use

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

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

type ConstraintError

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

ConstraintError returns when trying to create/update one or more entities and one or more of their constraints failed. For example, violation of edge or field uniqueness.

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

NotLoadedError returns when trying to get a node that was not loaded by the query.

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

func Log(fn func(...interface{})) Option

Log sets the logging function for debug mode.

type Order

type Order func(*sql.Selector)

Order applies an ordering on either graph traversal or sql selector.

func Asc

func Asc(fields ...string) Order

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) Order

Desc applies the given fields in DESC order.

type Query

type Query = ent.Query

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

type Robotstxt

type Robotstxt struct {

	// ID of the ent.
	ID int `json:"id,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"`
	// Host holds the value of the "host" field.
	Host string `json:"host,omitempty"`
	// Scheme holds the value of the "scheme" field.
	Scheme string `json:"scheme,omitempty"`
	// ResponseURL holds the value of the "response_url" field.
	ResponseURL string `json:"response_url,omitempty"`
	// Body holds the value of the "body" field.
	Body []byte `json:"body,omitempty"`
	// Statuscode holds the value of the "statuscode" field.
	Statuscode int32 `json:"statuscode,omitempty"`
	// ResponseTime holds the value of the "response_time" field.
	ResponseTime int64 `json:"response_time,omitempty"`
	// contains filtered or unexported fields
}

Robotstxt is the model entity for the Robotstxt schema.

func (*Robotstxt) String

func (r *Robotstxt) String() string

String implements the fmt.Stringer.

func (*Robotstxt) Unwrap

func (r *Robotstxt) Unwrap() *Robotstxt

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

func (r *Robotstxt) Update() *RobotstxtUpdateOne

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

type RobotstxtClient

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

RobotstxtClient is a client for the Robotstxt schema.

func NewRobotstxtClient

func NewRobotstxtClient(c config) *RobotstxtClient

NewRobotstxtClient returns a client for the Robotstxt from the given config.

func (*RobotstxtClient) Create

func (c *RobotstxtClient) Create() *RobotstxtCreate

Create returns a create builder for Robotstxt.

func (*RobotstxtClient) Delete

func (c *RobotstxtClient) Delete() *RobotstxtDelete

Delete returns a delete builder for Robotstxt.

func (*RobotstxtClient) DeleteOne

func (c *RobotstxtClient) DeleteOne(r *Robotstxt) *RobotstxtDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*RobotstxtClient) DeleteOneID

func (c *RobotstxtClient) DeleteOneID(id int) *RobotstxtDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*RobotstxtClient) Get

func (c *RobotstxtClient) Get(ctx context.Context, id int) (*Robotstxt, error)

Get returns a Robotstxt entity by its id.

func (*RobotstxtClient) GetX

func (c *RobotstxtClient) GetX(ctx context.Context, id int) *Robotstxt

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

func (*RobotstxtClient) Hooks

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

Hooks returns the client hooks.

func (*RobotstxtClient) Query

func (c *RobotstxtClient) Query() *RobotstxtQuery

Create returns a query builder for Robotstxt.

func (*RobotstxtClient) Update

func (c *RobotstxtClient) Update() *RobotstxtUpdate

Update returns an update builder for Robotstxt.

func (*RobotstxtClient) UpdateOne

func (c *RobotstxtClient) UpdateOne(r *Robotstxt) *RobotstxtUpdateOne

UpdateOne returns an update builder for the given entity.

func (*RobotstxtClient) UpdateOneID

func (c *RobotstxtClient) UpdateOneID(id int) *RobotstxtUpdateOne

UpdateOneID returns an update builder for the given id.

func (*RobotstxtClient) Use

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

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

type RobotstxtCreate

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

RobotstxtCreate is the builder for creating a Robotstxt entity.

func (*RobotstxtCreate) Save

func (rc *RobotstxtCreate) Save(ctx context.Context) (*Robotstxt, error)

Save creates the Robotstxt in the database.

func (*RobotstxtCreate) SaveX

func (rc *RobotstxtCreate) SaveX(ctx context.Context) *Robotstxt

SaveX calls Save and panics if Save returns an error.

func (*RobotstxtCreate) SetBody

func (rc *RobotstxtCreate) SetBody(b []byte) *RobotstxtCreate

SetBody sets the body field.

func (*RobotstxtCreate) SetCreatedAt

func (rc *RobotstxtCreate) SetCreatedAt(t time.Time) *RobotstxtCreate

SetCreatedAt sets the created_at field.

func (*RobotstxtCreate) SetHost

func (rc *RobotstxtCreate) SetHost(s string) *RobotstxtCreate

SetHost sets the host field.

func (*RobotstxtCreate) SetNillableCreatedAt

func (rc *RobotstxtCreate) SetNillableCreatedAt(t *time.Time) *RobotstxtCreate

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

func (*RobotstxtCreate) SetNillableUpdatedAt

func (rc *RobotstxtCreate) SetNillableUpdatedAt(t *time.Time) *RobotstxtCreate

SetNillableUpdatedAt sets the updated_at field if the given value is not nil.

func (*RobotstxtCreate) SetResponseTime

func (rc *RobotstxtCreate) SetResponseTime(i int64) *RobotstxtCreate

SetResponseTime sets the response_time field.

func (*RobotstxtCreate) SetResponseURL

func (rc *RobotstxtCreate) SetResponseURL(s string) *RobotstxtCreate

SetResponseURL sets the response_url field.

func (*RobotstxtCreate) SetScheme

func (rc *RobotstxtCreate) SetScheme(s string) *RobotstxtCreate

SetScheme sets the scheme field.

func (*RobotstxtCreate) SetStatuscode

func (rc *RobotstxtCreate) SetStatuscode(i int32) *RobotstxtCreate

SetStatuscode sets the statuscode field.

func (*RobotstxtCreate) SetUpdatedAt

func (rc *RobotstxtCreate) SetUpdatedAt(t time.Time) *RobotstxtCreate

SetUpdatedAt sets the updated_at field.

type RobotstxtDelete

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

RobotstxtDelete is the builder for deleting a Robotstxt entity.

func (*RobotstxtDelete) Exec

func (rd *RobotstxtDelete) Exec(ctx context.Context) (int, error)

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

func (*RobotstxtDelete) ExecX

func (rd *RobotstxtDelete) ExecX(ctx context.Context) int

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

func (*RobotstxtDelete) Where

Where adds a new predicate to the delete builder.

type RobotstxtDeleteOne

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

RobotstxtDeleteOne is the builder for deleting a single Robotstxt entity.

func (*RobotstxtDeleteOne) Exec

func (rdo *RobotstxtDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*RobotstxtDeleteOne) ExecX

func (rdo *RobotstxtDeleteOne) ExecX(ctx context.Context)

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

type RobotstxtGroupBy

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

RobotstxtGroupBy is the builder for group-by Robotstxt entities.

func (*RobotstxtGroupBy) Aggregate

func (rgb *RobotstxtGroupBy) Aggregate(fns ...Aggregate) *RobotstxtGroupBy

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

func (*RobotstxtGroupBy) Bools

func (rgb *RobotstxtGroupBy) 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 (*RobotstxtGroupBy) BoolsX

func (rgb *RobotstxtGroupBy) BoolsX(ctx context.Context) []bool

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

func (*RobotstxtGroupBy) Float64s

func (rgb *RobotstxtGroupBy) 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 (*RobotstxtGroupBy) Float64sX

func (rgb *RobotstxtGroupBy) Float64sX(ctx context.Context) []float64

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

func (*RobotstxtGroupBy) Ints

func (rgb *RobotstxtGroupBy) 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 (*RobotstxtGroupBy) IntsX

func (rgb *RobotstxtGroupBy) IntsX(ctx context.Context) []int

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

func (*RobotstxtGroupBy) Scan

func (rgb *RobotstxtGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*RobotstxtGroupBy) ScanX

func (rgb *RobotstxtGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*RobotstxtGroupBy) Strings

func (rgb *RobotstxtGroupBy) 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 (*RobotstxtGroupBy) StringsX

func (rgb *RobotstxtGroupBy) StringsX(ctx context.Context) []string

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

type RobotstxtMutation

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

RobotstxtMutation represents an operation that mutate the Robotstxts nodes in the graph.

func (*RobotstxtMutation) AddField

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

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

func (*RobotstxtMutation) AddResponseTime

func (m *RobotstxtMutation) AddResponseTime(i int64)

AddResponseTime adds i to response_time.

func (*RobotstxtMutation) AddStatuscode

func (m *RobotstxtMutation) AddStatuscode(i int32)

AddStatuscode adds i to statuscode.

func (*RobotstxtMutation) AddedEdges

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

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

func (*RobotstxtMutation) AddedField

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

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

func (*RobotstxtMutation) AddedFields

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

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

func (*RobotstxtMutation) AddedIDs

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

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

func (*RobotstxtMutation) AddedResponseTime

func (m *RobotstxtMutation) AddedResponseTime() (r int64, exists bool)

AddedResponseTime returns the value that was added to the response_time field in this mutation.

func (*RobotstxtMutation) AddedStatuscode

func (m *RobotstxtMutation) AddedStatuscode() (r int32, exists bool)

AddedStatuscode returns the value that was added to the statuscode field in this mutation.

func (*RobotstxtMutation) Body

func (m *RobotstxtMutation) Body() (r []byte, exists bool)

Body returns the body value in the mutation.

func (*RobotstxtMutation) ClearEdge

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

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

func (*RobotstxtMutation) ClearField

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

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

func (*RobotstxtMutation) ClearedEdges

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

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

func (*RobotstxtMutation) ClearedFields

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

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

func (RobotstxtMutation) Client

func (m RobotstxtMutation) Client() *Client

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

func (*RobotstxtMutation) CreatedAt

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

CreatedAt returns the created_at value in the mutation.

func (*RobotstxtMutation) EdgeCleared

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

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

func (*RobotstxtMutation) Field

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

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

func (*RobotstxtMutation) FieldCleared

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

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

func (*RobotstxtMutation) Fields

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

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

func (*RobotstxtMutation) Host

func (m *RobotstxtMutation) Host() (r string, exists bool)

Host returns the host value in the mutation.

func (*RobotstxtMutation) ID

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

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

func (*RobotstxtMutation) Op

func (m *RobotstxtMutation) Op() Op

Op returns the operation name.

func (*RobotstxtMutation) RemovedEdges

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

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

func (*RobotstxtMutation) RemovedIDs

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

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

func (*RobotstxtMutation) ResetBody

func (m *RobotstxtMutation) ResetBody()

ResetBody reset all changes of the body field.

func (*RobotstxtMutation) ResetCreatedAt

func (m *RobotstxtMutation) ResetCreatedAt()

ResetCreatedAt reset all changes of the created_at field.

func (*RobotstxtMutation) ResetEdge

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

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

func (*RobotstxtMutation) ResetField

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

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

func (*RobotstxtMutation) ResetHost

func (m *RobotstxtMutation) ResetHost()

ResetHost reset all changes of the host field.

func (*RobotstxtMutation) ResetResponseTime

func (m *RobotstxtMutation) ResetResponseTime()

ResetResponseTime reset all changes of the response_time field.

func (*RobotstxtMutation) ResetResponseURL

func (m *RobotstxtMutation) ResetResponseURL()

ResetResponseURL reset all changes of the response_url field.

func (*RobotstxtMutation) ResetScheme

func (m *RobotstxtMutation) ResetScheme()

ResetScheme reset all changes of the scheme field.

func (*RobotstxtMutation) ResetStatuscode

func (m *RobotstxtMutation) ResetStatuscode()

ResetStatuscode reset all changes of the statuscode field.

func (*RobotstxtMutation) ResetUpdatedAt

func (m *RobotstxtMutation) ResetUpdatedAt()

ResetUpdatedAt reset all changes of the updated_at field.

func (*RobotstxtMutation) ResponseTime

func (m *RobotstxtMutation) ResponseTime() (r int64, exists bool)

ResponseTime returns the response_time value in the mutation.

func (*RobotstxtMutation) ResponseURL

func (m *RobotstxtMutation) ResponseURL() (r string, exists bool)

ResponseURL returns the response_url value in the mutation.

func (*RobotstxtMutation) Scheme

func (m *RobotstxtMutation) Scheme() (r string, exists bool)

Scheme returns the scheme value in the mutation.

func (*RobotstxtMutation) SetBody

func (m *RobotstxtMutation) SetBody(b []byte)

SetBody sets the body field.

func (*RobotstxtMutation) SetCreatedAt

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

SetCreatedAt sets the created_at field.

func (*RobotstxtMutation) SetField

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

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

func (*RobotstxtMutation) SetHost

func (m *RobotstxtMutation) SetHost(s string)

SetHost sets the host field.

func (*RobotstxtMutation) SetResponseTime

func (m *RobotstxtMutation) SetResponseTime(i int64)

SetResponseTime sets the response_time field.

func (*RobotstxtMutation) SetResponseURL

func (m *RobotstxtMutation) SetResponseURL(s string)

SetResponseURL sets the response_url field.

func (*RobotstxtMutation) SetScheme

func (m *RobotstxtMutation) SetScheme(s string)

SetScheme sets the scheme field.

func (*RobotstxtMutation) SetStatuscode

func (m *RobotstxtMutation) SetStatuscode(i int32)

SetStatuscode sets the statuscode field.

func (*RobotstxtMutation) SetUpdatedAt

func (m *RobotstxtMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the updated_at field.

func (*RobotstxtMutation) Statuscode

func (m *RobotstxtMutation) Statuscode() (r int32, exists bool)

Statuscode returns the statuscode value in the mutation.

func (RobotstxtMutation) Tx

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

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

func (*RobotstxtMutation) Type

func (m *RobotstxtMutation) Type() string

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

func (*RobotstxtMutation) UpdatedAt

func (m *RobotstxtMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the updated_at value in the mutation.

type RobotstxtQuery

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

RobotstxtQuery is the builder for querying Robotstxt entities.

func (*RobotstxtQuery) All

func (rq *RobotstxtQuery) All(ctx context.Context) ([]*Robotstxt, error)

All executes the query and returns a list of Robotstxts.

func (*RobotstxtQuery) AllX

func (rq *RobotstxtQuery) AllX(ctx context.Context) []*Robotstxt

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

func (*RobotstxtQuery) Clone

func (rq *RobotstxtQuery) Clone() *RobotstxtQuery

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

func (rq *RobotstxtQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*RobotstxtQuery) CountX

func (rq *RobotstxtQuery) CountX(ctx context.Context) int

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

func (*RobotstxtQuery) Exist

func (rq *RobotstxtQuery) Exist(ctx context.Context) (bool, error)

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

func (*RobotstxtQuery) ExistX

func (rq *RobotstxtQuery) ExistX(ctx context.Context) bool

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

func (*RobotstxtQuery) First

func (rq *RobotstxtQuery) First(ctx context.Context) (*Robotstxt, error)

First returns the first Robotstxt entity in the query. Returns *NotFoundError when no robotstxt was found.

func (*RobotstxtQuery) FirstID

func (rq *RobotstxtQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*RobotstxtQuery) FirstX

func (rq *RobotstxtQuery) FirstX(ctx context.Context) *Robotstxt

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

func (*RobotstxtQuery) FirstXID

func (rq *RobotstxtQuery) FirstXID(ctx context.Context) int

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

func (*RobotstxtQuery) GroupBy

func (rq *RobotstxtQuery) GroupBy(field string, fields ...string) *RobotstxtGroupBy

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

client.Robotstxt.Query().
	GroupBy(robotstxt.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*RobotstxtQuery) IDs

func (rq *RobotstxtQuery) IDs(ctx context.Context) ([]int, error)

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

func (*RobotstxtQuery) IDsX

func (rq *RobotstxtQuery) IDsX(ctx context.Context) []int

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

func (*RobotstxtQuery) Limit

func (rq *RobotstxtQuery) Limit(limit int) *RobotstxtQuery

Limit adds a limit step to the query.

func (*RobotstxtQuery) Offset

func (rq *RobotstxtQuery) Offset(offset int) *RobotstxtQuery

Offset adds an offset step to the query.

func (*RobotstxtQuery) Only

func (rq *RobotstxtQuery) Only(ctx context.Context) (*Robotstxt, error)

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

func (*RobotstxtQuery) OnlyID

func (rq *RobotstxtQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*RobotstxtQuery) OnlyX

func (rq *RobotstxtQuery) OnlyX(ctx context.Context) *Robotstxt

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

func (*RobotstxtQuery) OnlyXID

func (rq *RobotstxtQuery) OnlyXID(ctx context.Context) int

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

func (*RobotstxtQuery) Order

func (rq *RobotstxtQuery) Order(o ...Order) *RobotstxtQuery

Order adds an order step to the query.

func (*RobotstxtQuery) Select

func (rq *RobotstxtQuery) Select(field string, fields ...string) *RobotstxtSelect

Select one or more fields from the given query.

Example:

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

client.Robotstxt.Query().
	Select(robotstxt.FieldCreatedAt).
	Scan(ctx, &v)

func (*RobotstxtQuery) Where

Where adds a new predicate for the builder.

type RobotstxtSelect

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

RobotstxtSelect is the builder for select fields of Robotstxt entities.

func (*RobotstxtSelect) Bools

func (rs *RobotstxtSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*RobotstxtSelect) BoolsX

func (rs *RobotstxtSelect) BoolsX(ctx context.Context) []bool

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

func (*RobotstxtSelect) Float64s

func (rs *RobotstxtSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*RobotstxtSelect) Float64sX

func (rs *RobotstxtSelect) Float64sX(ctx context.Context) []float64

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

func (*RobotstxtSelect) Ints

func (rs *RobotstxtSelect) Ints(ctx context.Context) ([]int, error)

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

func (*RobotstxtSelect) IntsX

func (rs *RobotstxtSelect) IntsX(ctx context.Context) []int

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

func (*RobotstxtSelect) Scan

func (rs *RobotstxtSelect) Scan(ctx context.Context, v interface{}) error

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

func (*RobotstxtSelect) ScanX

func (rs *RobotstxtSelect) ScanX(ctx context.Context, v interface{})

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

func (*RobotstxtSelect) Strings

func (rs *RobotstxtSelect) Strings(ctx context.Context) ([]string, error)

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

func (*RobotstxtSelect) StringsX

func (rs *RobotstxtSelect) StringsX(ctx context.Context) []string

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

type RobotstxtUpdate

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

RobotstxtUpdate is the builder for updating Robotstxt entities.

func (*RobotstxtUpdate) AddResponseTime

func (ru *RobotstxtUpdate) AddResponseTime(i int64) *RobotstxtUpdate

AddResponseTime adds i to response_time.

func (*RobotstxtUpdate) AddStatuscode

func (ru *RobotstxtUpdate) AddStatuscode(i int32) *RobotstxtUpdate

AddStatuscode adds i to statuscode.

func (*RobotstxtUpdate) Exec

func (ru *RobotstxtUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*RobotstxtUpdate) ExecX

func (ru *RobotstxtUpdate) ExecX(ctx context.Context)

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

func (*RobotstxtUpdate) Save

func (ru *RobotstxtUpdate) Save(ctx context.Context) (int, error)

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

func (*RobotstxtUpdate) SaveX

func (ru *RobotstxtUpdate) SaveX(ctx context.Context) int

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

func (*RobotstxtUpdate) SetBody

func (ru *RobotstxtUpdate) SetBody(b []byte) *RobotstxtUpdate

SetBody sets the body field.

func (*RobotstxtUpdate) SetHost

func (ru *RobotstxtUpdate) SetHost(s string) *RobotstxtUpdate

SetHost sets the host field.

func (*RobotstxtUpdate) SetResponseTime

func (ru *RobotstxtUpdate) SetResponseTime(i int64) *RobotstxtUpdate

SetResponseTime sets the response_time field.

func (*RobotstxtUpdate) SetResponseURL

func (ru *RobotstxtUpdate) SetResponseURL(s string) *RobotstxtUpdate

SetResponseURL sets the response_url field.

func (*RobotstxtUpdate) SetScheme

func (ru *RobotstxtUpdate) SetScheme(s string) *RobotstxtUpdate

SetScheme sets the scheme field.

func (*RobotstxtUpdate) SetStatuscode

func (ru *RobotstxtUpdate) SetStatuscode(i int32) *RobotstxtUpdate

SetStatuscode sets the statuscode field.

func (*RobotstxtUpdate) SetUpdatedAt

func (ru *RobotstxtUpdate) SetUpdatedAt(t time.Time) *RobotstxtUpdate

SetUpdatedAt sets the updated_at field.

func (*RobotstxtUpdate) Where

Where adds a new predicate for the builder.

type RobotstxtUpdateOne

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

RobotstxtUpdateOne is the builder for updating a single Robotstxt entity.

func (*RobotstxtUpdateOne) AddResponseTime

func (ruo *RobotstxtUpdateOne) AddResponseTime(i int64) *RobotstxtUpdateOne

AddResponseTime adds i to response_time.

func (*RobotstxtUpdateOne) AddStatuscode

func (ruo *RobotstxtUpdateOne) AddStatuscode(i int32) *RobotstxtUpdateOne

AddStatuscode adds i to statuscode.

func (*RobotstxtUpdateOne) Exec

func (ruo *RobotstxtUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*RobotstxtUpdateOne) ExecX

func (ruo *RobotstxtUpdateOne) ExecX(ctx context.Context)

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

func (*RobotstxtUpdateOne) Save

func (ruo *RobotstxtUpdateOne) Save(ctx context.Context) (*Robotstxt, error)

Save executes the query and returns the updated entity.

func (*RobotstxtUpdateOne) SaveX

func (ruo *RobotstxtUpdateOne) SaveX(ctx context.Context) *Robotstxt

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

func (*RobotstxtUpdateOne) SetBody

func (ruo *RobotstxtUpdateOne) SetBody(b []byte) *RobotstxtUpdateOne

SetBody sets the body field.

func (*RobotstxtUpdateOne) SetHost

func (ruo *RobotstxtUpdateOne) SetHost(s string) *RobotstxtUpdateOne

SetHost sets the host field.

func (*RobotstxtUpdateOne) SetResponseTime

func (ruo *RobotstxtUpdateOne) SetResponseTime(i int64) *RobotstxtUpdateOne

SetResponseTime sets the response_time field.

func (*RobotstxtUpdateOne) SetResponseURL

func (ruo *RobotstxtUpdateOne) SetResponseURL(s string) *RobotstxtUpdateOne

SetResponseURL sets the response_url field.

func (*RobotstxtUpdateOne) SetScheme

func (ruo *RobotstxtUpdateOne) SetScheme(s string) *RobotstxtUpdateOne

SetScheme sets the scheme field.

func (*RobotstxtUpdateOne) SetStatuscode

func (ruo *RobotstxtUpdateOne) SetStatuscode(i int32) *RobotstxtUpdateOne

SetStatuscode sets the statuscode field.

func (*RobotstxtUpdateOne) SetUpdatedAt

func (ruo *RobotstxtUpdateOne) SetUpdatedAt(t time.Time) *RobotstxtUpdateOne

SetUpdatedAt sets the updated_at field.

type Robotstxts

type Robotstxts []*Robotstxt

Robotstxts is a parsable slice of Robotstxt.

type Tx

type Tx struct {

	// Robotstxt is the client for interacting with the Robotstxt builders.
	Robotstxt *RobotstxtClient
	// contains filtered or unexported fields
}

Tx is a transactional client that is created by calling Client.Tx().

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type Value

type Value = ent.Value

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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