ent

package
v0.0.0-...-84b0f7e Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2020 License: ISC Imports: 30 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.
	TypeAccount      = "Account"
	TypeCampaign     = "Campaign"
	TypeOrganization = "Organization"
)

Variables

View Source
var DefaultAccountOrder = &AccountOrder{
	Direction: OrderDirectionAsc,
	Field: &AccountOrderField{
		field: account.FieldID,
		toCursor: func(a *Account) Cursor {
			return Cursor{ID: a.ID}
		},
	},
}

DefaultAccountOrder is the default ordering of Account.

View Source
var DefaultCampaignOrder = &CampaignOrder{
	Direction: OrderDirectionAsc,
	Field: &CampaignOrderField{
		field: campaign.FieldID,
		toCursor: func(c *Campaign) Cursor {
			return Cursor{ID: c.ID}
		},
	},
}

DefaultCampaignOrder is the default ordering of Campaign.

View Source
var DefaultOrganizationOrder = &OrganizationOrder{
	Direction: OrderDirectionAsc,
	Field: &OrganizationOrderField{
		field: organization.FieldID,
		toCursor: func(o *Organization) Cursor {
			return Cursor{ID: o.ID}
		},
	},
}

DefaultOrganizationOrder is the default ordering of Organization.

Functions

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Client attached.

func OpenTxFromContext

func OpenTxFromContext(ctx context.Context) (context.Context, driver.Tx, error)

OpenTxFromContext open transactions from client stored in context.

Types

type Account

type Account struct {

	// ID of the ent.
	ID pulid.ID `json:"id,omitempty"`
	// EmailAddress holds the value of the "email_address" field.
	EmailAddress string `json:"email_address,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the AccountQuery when eager-loading is set.
	Edges AccountEdges `json:"edges"`
	// contains filtered or unexported fields
}

Account is the model entity for the Account schema.

func (*Account) Node

func (a *Account) Node(ctx context.Context) (node *Node, err error)

func (*Account) Organization

func (a *Account) Organization(ctx context.Context) ([]*Organization, error)

func (*Account) QueryOrganization

func (a *Account) QueryOrganization() *OrganizationQuery

QueryOrganization queries the organization edge of the Account.

func (*Account) String

func (a *Account) String() string

String implements the fmt.Stringer.

func (*Account) ToEdge

func (a *Account) ToEdge(order *AccountOrder) *AccountEdge

ToEdge converts Account into AccountEdge.

func (*Account) Unwrap

func (a *Account) Unwrap() *Account

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

func (a *Account) Update() *AccountUpdateOne

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

type AccountClient

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

AccountClient is a client for the Account schema.

func NewAccountClient

func NewAccountClient(c config) *AccountClient

NewAccountClient returns a client for the Account from the given config.

func (*AccountClient) Create

func (c *AccountClient) Create() *AccountCreate

Create returns a create builder for Account.

func (*AccountClient) CreateBulk

func (c *AccountClient) CreateBulk(builders ...*AccountCreate) *AccountCreateBulk

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

func (*AccountClient) Delete

func (c *AccountClient) Delete() *AccountDelete

Delete returns a delete builder for Account.

func (*AccountClient) DeleteOne

func (c *AccountClient) DeleteOne(a *Account) *AccountDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*AccountClient) DeleteOneID

func (c *AccountClient) DeleteOneID(id pulid.ID) *AccountDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*AccountClient) Get

func (c *AccountClient) Get(ctx context.Context, id pulid.ID) (*Account, error)

Get returns a Account entity by its id.

func (*AccountClient) GetX

func (c *AccountClient) GetX(ctx context.Context, id pulid.ID) *Account

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

func (*AccountClient) Hooks

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

Hooks returns the client hooks.

func (*AccountClient) Query

func (c *AccountClient) Query() *AccountQuery

Query returns a query builder for Account.

func (*AccountClient) QueryOrganization

func (c *AccountClient) QueryOrganization(a *Account) *OrganizationQuery

QueryOrganization queries the organization edge of a Account.

func (*AccountClient) Update

func (c *AccountClient) Update() *AccountUpdate

Update returns an update builder for Account.

func (*AccountClient) UpdateOne

func (c *AccountClient) UpdateOne(a *Account) *AccountUpdateOne

UpdateOne returns an update builder for the given entity.

func (*AccountClient) UpdateOneID

func (c *AccountClient) UpdateOneID(id pulid.ID) *AccountUpdateOne

UpdateOneID returns an update builder for the given id.

func (*AccountClient) Use

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

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

type AccountConnection

type AccountConnection struct {
	Edges      []*AccountEdge `json:"edges"`
	PageInfo   PageInfo       `json:"pageInfo"`
	TotalCount int            `json:"totalCount"`
}

AccountConnection is the connection containing edges to Account.

type AccountCreate

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

AccountCreate is the builder for creating a Account entity.

func (*AccountCreate) AddOrganization

func (ac *AccountCreate) AddOrganization(o ...*Organization) *AccountCreate

AddOrganization adds the organization edges to Organization.

func (*AccountCreate) AddOrganizationIDs

func (ac *AccountCreate) AddOrganizationIDs(ids ...pulid.ID) *AccountCreate

AddOrganizationIDs adds the organization edge to Organization by ids.

func (*AccountCreate) Mutation

func (ac *AccountCreate) Mutation() *AccountMutation

Mutation returns the AccountMutation object of the builder.

func (*AccountCreate) Save

func (ac *AccountCreate) Save(ctx context.Context) (*Account, error)

Save creates the Account in the database.

func (*AccountCreate) SaveX

func (ac *AccountCreate) SaveX(ctx context.Context) *Account

SaveX calls Save and panics if Save returns an error.

func (*AccountCreate) SetEmailAddress

func (ac *AccountCreate) SetEmailAddress(s string) *AccountCreate

SetEmailAddress sets the email_address field.

func (*AccountCreate) SetID

func (ac *AccountCreate) SetID(pu pulid.ID) *AccountCreate

SetID sets the id field.

type AccountCreateBulk

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

AccountCreateBulk is the builder for creating a bulk of Account entities.

func (*AccountCreateBulk) Save

func (acb *AccountCreateBulk) Save(ctx context.Context) ([]*Account, error)

Save creates the Account entities in the database.

func (*AccountCreateBulk) SaveX

func (acb *AccountCreateBulk) SaveX(ctx context.Context) []*Account

SaveX calls Save and panics if Save returns an error.

type AccountDelete

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

AccountDelete is the builder for deleting a Account entity.

func (*AccountDelete) Exec

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

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

func (*AccountDelete) ExecX

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

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

func (*AccountDelete) Where

func (ad *AccountDelete) Where(ps ...predicate.Account) *AccountDelete

Where adds a new predicate to the delete builder.

type AccountDeleteOne

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

AccountDeleteOne is the builder for deleting a single Account entity.

func (*AccountDeleteOne) Exec

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

Exec executes the deletion query.

func (*AccountDeleteOne) ExecX

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

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

type AccountEdge

type AccountEdge struct {
	Node   *Account `json:"node"`
	Cursor Cursor   `json:"cursor"`
}

AccountEdge is the edge representation of Account.

type AccountEdges

type AccountEdges struct {
	// Organization holds the value of the organization edge.
	Organization []*Organization
	// contains filtered or unexported fields
}

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

func (AccountEdges) OrganizationOrErr

func (e AccountEdges) OrganizationOrErr() ([]*Organization, error)

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

type AccountGroupBy

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

AccountGroupBy is the builder for group-by Account entities.

func (*AccountGroupBy) Aggregate

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

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

func (*AccountGroupBy) Bool

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

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

func (*AccountGroupBy) BoolX

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

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

func (*AccountGroupBy) Bools

func (agb *AccountGroupBy) 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 (*AccountGroupBy) BoolsX

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

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

func (*AccountGroupBy) Float64

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

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

func (*AccountGroupBy) Float64X

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

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

func (*AccountGroupBy) Float64s

func (agb *AccountGroupBy) 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 (*AccountGroupBy) Float64sX

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

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

func (*AccountGroupBy) Int

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

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

func (*AccountGroupBy) IntX

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

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

func (*AccountGroupBy) Ints

func (agb *AccountGroupBy) 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 (*AccountGroupBy) IntsX

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

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

func (*AccountGroupBy) Scan

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

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

func (*AccountGroupBy) ScanX

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

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

func (*AccountGroupBy) String

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

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

func (*AccountGroupBy) StringX

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

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

func (*AccountGroupBy) Strings

func (agb *AccountGroupBy) 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 (*AccountGroupBy) StringsX

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

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

type AccountMutation

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

AccountMutation represents an operation that mutate the Accounts nodes in the graph.

func (*AccountMutation) AddField

func (m *AccountMutation) 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 (*AccountMutation) AddOrganizationIDs

func (m *AccountMutation) AddOrganizationIDs(ids ...pulid.ID)

AddOrganizationIDs adds the organization edge to Organization by ids.

func (*AccountMutation) AddedEdges

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

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

func (*AccountMutation) AddedField

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

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

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

func (*AccountMutation) AddedIDs

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

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

func (*AccountMutation) ClearEdge

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

func (m *AccountMutation) 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 (*AccountMutation) ClearOrganization

func (m *AccountMutation) ClearOrganization()

ClearOrganization clears the organization edge to Organization.

func (*AccountMutation) ClearedEdges

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

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

func (*AccountMutation) ClearedFields

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

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

func (AccountMutation) Client

func (m AccountMutation) 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 (*AccountMutation) EdgeCleared

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

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

func (*AccountMutation) EmailAddress

func (m *AccountMutation) EmailAddress() (r string, exists bool)

EmailAddress returns the email_address value in the mutation.

func (*AccountMutation) Field

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

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

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

func (*AccountMutation) Fields

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

func (m *AccountMutation) ID() (id pulid.ID, 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 (*AccountMutation) OldEmailAddress

func (m *AccountMutation) OldEmailAddress(ctx context.Context) (v string, err error)

OldEmailAddress returns the old email_address value of the Account. If the Account object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or database query fails.

func (*AccountMutation) OldField

func (m *AccountMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database was failed.

func (*AccountMutation) Op

func (m *AccountMutation) Op() Op

Op returns the operation name.

func (*AccountMutation) OrganizationCleared

func (m *AccountMutation) OrganizationCleared() bool

OrganizationCleared returns if the edge organization was cleared.

func (*AccountMutation) OrganizationIDs

func (m *AccountMutation) OrganizationIDs() (ids []pulid.ID)

OrganizationIDs returns the organization ids in the mutation.

func (*AccountMutation) RemoveOrganizationIDs

func (m *AccountMutation) RemoveOrganizationIDs(ids ...pulid.ID)

RemoveOrganizationIDs removes the organization edge to Organization by ids.

func (*AccountMutation) RemovedEdges

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

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

func (*AccountMutation) RemovedIDs

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

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

func (*AccountMutation) RemovedOrganizationIDs

func (m *AccountMutation) RemovedOrganizationIDs() (ids []pulid.ID)

RemovedOrganization returns the removed ids of organization.

func (*AccountMutation) ResetEdge

func (m *AccountMutation) 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 (*AccountMutation) ResetEmailAddress

func (m *AccountMutation) ResetEmailAddress()

ResetEmailAddress reset all changes of the "email_address" field.

func (*AccountMutation) ResetField

func (m *AccountMutation) 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 (*AccountMutation) ResetOrganization

func (m *AccountMutation) ResetOrganization()

ResetOrganization reset all changes of the "organization" edge.

func (*AccountMutation) SetEmailAddress

func (m *AccountMutation) SetEmailAddress(s string)

SetEmailAddress sets the email_address field.

func (*AccountMutation) SetField

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

func (m *AccountMutation) SetID(id pulid.ID)

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

func (AccountMutation) Tx

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

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

func (*AccountMutation) Type

func (m *AccountMutation) Type() string

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

type AccountOrder

type AccountOrder struct {
	Direction OrderDirection     `json:"direction"`
	Field     *AccountOrderField `json:"field"`
}

AccountOrder defines the ordering of Account.

type AccountOrderField

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

AccountOrderField defines the ordering field of Account.

type AccountPaginateOption

type AccountPaginateOption func(*accountPager) error

AccountPaginateOption enables pagination customization.

func WithAccountFilter

func WithAccountFilter(filter func(*AccountQuery) (*AccountQuery, error)) AccountPaginateOption

WithAccountFilter configures pagination filter.

func WithAccountOrder

func WithAccountOrder(order *AccountOrder) AccountPaginateOption

WithAccountOrder configures pagination ordering.

type AccountQuery

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

AccountQuery is the builder for querying Account entities.

func (*AccountQuery) All

func (aq *AccountQuery) All(ctx context.Context) ([]*Account, error)

All executes the query and returns a list of Accounts.

func (*AccountQuery) AllX

func (aq *AccountQuery) AllX(ctx context.Context) []*Account

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

func (*AccountQuery) Clone

func (aq *AccountQuery) Clone() *AccountQuery

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 (*AccountQuery) CollectFields

func (a *AccountQuery) CollectFields(ctx context.Context, satisfies ...string) *AccountQuery

CollectFields tells the query-builder to eagerly load connected nodes by resolver context.

func (*AccountQuery) Count

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

Count returns the count of the given query.

func (*AccountQuery) CountX

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

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

func (*AccountQuery) Exist

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

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

func (*AccountQuery) ExistX

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

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

func (*AccountQuery) First

func (aq *AccountQuery) First(ctx context.Context) (*Account, error)

First returns the first Account entity in the query. Returns *NotFoundError when no account was found.

func (*AccountQuery) FirstID

func (aq *AccountQuery) FirstID(ctx context.Context) (id pulid.ID, err error)

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

func (*AccountQuery) FirstIDX

func (aq *AccountQuery) FirstIDX(ctx context.Context) pulid.ID

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

func (*AccountQuery) FirstX

func (aq *AccountQuery) FirstX(ctx context.Context) *Account

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

func (*AccountQuery) GroupBy

func (aq *AccountQuery) GroupBy(field string, fields ...string) *AccountGroupBy

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

client.Account.Query().
	GroupBy(account.FieldEmailAddress).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*AccountQuery) IDs

func (aq *AccountQuery) IDs(ctx context.Context) ([]pulid.ID, error)

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

func (*AccountQuery) IDsX

func (aq *AccountQuery) IDsX(ctx context.Context) []pulid.ID

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

func (*AccountQuery) Limit

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

Limit adds a limit step to the query.

func (*AccountQuery) Offset

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

Offset adds an offset step to the query.

func (*AccountQuery) Only

func (aq *AccountQuery) Only(ctx context.Context) (*Account, error)

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

func (*AccountQuery) OnlyID

func (aq *AccountQuery) OnlyID(ctx context.Context) (id pulid.ID, err error)

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

func (*AccountQuery) OnlyIDX

func (aq *AccountQuery) OnlyIDX(ctx context.Context) pulid.ID

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

func (*AccountQuery) OnlyX

func (aq *AccountQuery) OnlyX(ctx context.Context) *Account

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

func (*AccountQuery) Order

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

Order adds an order step to the query.

func (*AccountQuery) Paginate

func (a *AccountQuery) Paginate(
	ctx context.Context, after *Cursor, first *int,
	before *Cursor, last *int, opts ...AccountPaginateOption,
) (*AccountConnection, error)

Paginate executes the query and returns a relay based cursor connection to Account.

func (*AccountQuery) QueryOrganization

func (aq *AccountQuery) QueryOrganization() *OrganizationQuery

QueryOrganization chains the current query on the organization edge.

func (*AccountQuery) Select

func (aq *AccountQuery) Select(field string, fields ...string) *AccountSelect

Select one or more fields from the given query.

Example:

var v []struct {
	EmailAddress string `json:"email_address,omitempty"`
}

client.Account.Query().
	Select(account.FieldEmailAddress).
	Scan(ctx, &v)

func (*AccountQuery) Where

func (aq *AccountQuery) Where(ps ...predicate.Account) *AccountQuery

Where adds a new predicate for the builder.

func (*AccountQuery) WithOrganization

func (aq *AccountQuery) WithOrganization(opts ...func(*OrganizationQuery)) *AccountQuery
WithOrganization tells the query-builder to eager-loads the nodes that are connected to

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

type AccountSelect

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

AccountSelect is the builder for select fields of Account entities.

func (*AccountSelect) Bool

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

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

func (*AccountSelect) BoolX

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

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

func (*AccountSelect) Bools

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

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

func (*AccountSelect) BoolsX

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

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

func (*AccountSelect) Float64

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

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

func (*AccountSelect) Float64X

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

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

func (*AccountSelect) Float64s

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

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

func (*AccountSelect) Float64sX

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

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

func (*AccountSelect) Int

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

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

func (*AccountSelect) IntX

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

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

func (*AccountSelect) Ints

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

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

func (*AccountSelect) IntsX

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

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

func (*AccountSelect) Scan

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

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

func (*AccountSelect) ScanX

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

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

func (*AccountSelect) String

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

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

func (*AccountSelect) StringX

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

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

func (*AccountSelect) Strings

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

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

func (*AccountSelect) StringsX

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

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

type AccountUpdate

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

AccountUpdate is the builder for updating Account entities.

func (*AccountUpdate) AddOrganization

func (au *AccountUpdate) AddOrganization(o ...*Organization) *AccountUpdate

AddOrganization adds the organization edges to Organization.

func (*AccountUpdate) AddOrganizationIDs

func (au *AccountUpdate) AddOrganizationIDs(ids ...pulid.ID) *AccountUpdate

AddOrganizationIDs adds the organization edge to Organization by ids.

func (*AccountUpdate) ClearOrganization

func (au *AccountUpdate) ClearOrganization() *AccountUpdate

ClearOrganization clears all "organization" edges to type Organization.

func (*AccountUpdate) Exec

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

Exec executes the query.

func (*AccountUpdate) ExecX

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

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

func (*AccountUpdate) Mutation

func (au *AccountUpdate) Mutation() *AccountMutation

Mutation returns the AccountMutation object of the builder.

func (*AccountUpdate) RemoveOrganization

func (au *AccountUpdate) RemoveOrganization(o ...*Organization) *AccountUpdate

RemoveOrganization removes organization edges to Organization.

func (*AccountUpdate) RemoveOrganizationIDs

func (au *AccountUpdate) RemoveOrganizationIDs(ids ...pulid.ID) *AccountUpdate

RemoveOrganizationIDs removes the organization edge to Organization by ids.

func (*AccountUpdate) Save

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

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

func (*AccountUpdate) SaveX

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

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

func (*AccountUpdate) SetEmailAddress

func (au *AccountUpdate) SetEmailAddress(s string) *AccountUpdate

SetEmailAddress sets the email_address field.

func (*AccountUpdate) Where

func (au *AccountUpdate) Where(ps ...predicate.Account) *AccountUpdate

Where adds a new predicate for the builder.

type AccountUpdateOne

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

AccountUpdateOne is the builder for updating a single Account entity.

func (*AccountUpdateOne) AddOrganization

func (auo *AccountUpdateOne) AddOrganization(o ...*Organization) *AccountUpdateOne

AddOrganization adds the organization edges to Organization.

func (*AccountUpdateOne) AddOrganizationIDs

func (auo *AccountUpdateOne) AddOrganizationIDs(ids ...pulid.ID) *AccountUpdateOne

AddOrganizationIDs adds the organization edge to Organization by ids.

func (*AccountUpdateOne) ClearOrganization

func (auo *AccountUpdateOne) ClearOrganization() *AccountUpdateOne

ClearOrganization clears all "organization" edges to type Organization.

func (*AccountUpdateOne) Exec

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

Exec executes the query on the entity.

func (*AccountUpdateOne) ExecX

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

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

func (*AccountUpdateOne) Mutation

func (auo *AccountUpdateOne) Mutation() *AccountMutation

Mutation returns the AccountMutation object of the builder.

func (*AccountUpdateOne) RemoveOrganization

func (auo *AccountUpdateOne) RemoveOrganization(o ...*Organization) *AccountUpdateOne

RemoveOrganization removes organization edges to Organization.

func (*AccountUpdateOne) RemoveOrganizationIDs

func (auo *AccountUpdateOne) RemoveOrganizationIDs(ids ...pulid.ID) *AccountUpdateOne

RemoveOrganizationIDs removes the organization edge to Organization by ids.

func (*AccountUpdateOne) Save

func (auo *AccountUpdateOne) Save(ctx context.Context) (*Account, error)

Save executes the query and returns the updated entity.

func (*AccountUpdateOne) SaveX

func (auo *AccountUpdateOne) SaveX(ctx context.Context) *Account

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

func (*AccountUpdateOne) SetEmailAddress

func (auo *AccountUpdateOne) SetEmailAddress(s string) *AccountUpdateOne

SetEmailAddress sets the email_address field.

type Accounts

type Accounts []*Account

Accounts is a parsable slice of Account.

type AggregateFunc

type AggregateFunc func(*sql.Selector, func(string) bool) string

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

func As

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

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type Campaign

type Campaign struct {

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

Campaign is the model entity for the Campaign schema.

func (*Campaign) Node

func (c *Campaign) Node(ctx context.Context) (node *Node, err error)

func (*Campaign) String

func (c *Campaign) String() string

String implements the fmt.Stringer.

func (*Campaign) ToEdge

func (c *Campaign) ToEdge(order *CampaignOrder) *CampaignEdge

ToEdge converts Campaign into CampaignEdge.

func (*Campaign) Unwrap

func (c *Campaign) Unwrap() *Campaign

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

func (c *Campaign) Update() *CampaignUpdateOne

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

type CampaignClient

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

CampaignClient is a client for the Campaign schema.

func NewCampaignClient

func NewCampaignClient(c config) *CampaignClient

NewCampaignClient returns a client for the Campaign from the given config.

func (*CampaignClient) Create

func (c *CampaignClient) Create() *CampaignCreate

Create returns a create builder for Campaign.

func (*CampaignClient) CreateBulk

func (c *CampaignClient) CreateBulk(builders ...*CampaignCreate) *CampaignCreateBulk

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

func (*CampaignClient) Delete

func (c *CampaignClient) Delete() *CampaignDelete

Delete returns a delete builder for Campaign.

func (*CampaignClient) DeleteOne

func (c *CampaignClient) DeleteOne(ca *Campaign) *CampaignDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*CampaignClient) DeleteOneID

func (c *CampaignClient) DeleteOneID(id pulid.ID) *CampaignDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*CampaignClient) Get

func (c *CampaignClient) Get(ctx context.Context, id pulid.ID) (*Campaign, error)

Get returns a Campaign entity by its id.

func (*CampaignClient) GetX

func (c *CampaignClient) GetX(ctx context.Context, id pulid.ID) *Campaign

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

func (*CampaignClient) Hooks

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

Hooks returns the client hooks.

func (*CampaignClient) Query

func (c *CampaignClient) Query() *CampaignQuery

Query returns a query builder for Campaign.

func (*CampaignClient) Update

func (c *CampaignClient) Update() *CampaignUpdate

Update returns an update builder for Campaign.

func (*CampaignClient) UpdateOne

func (c *CampaignClient) UpdateOne(ca *Campaign) *CampaignUpdateOne

UpdateOne returns an update builder for the given entity.

func (*CampaignClient) UpdateOneID

func (c *CampaignClient) UpdateOneID(id pulid.ID) *CampaignUpdateOne

UpdateOneID returns an update builder for the given id.

func (*CampaignClient) Use

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

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

type CampaignConnection

type CampaignConnection struct {
	Edges      []*CampaignEdge `json:"edges"`
	PageInfo   PageInfo        `json:"pageInfo"`
	TotalCount int             `json:"totalCount"`
}

CampaignConnection is the connection containing edges to Campaign.

type CampaignCreate

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

CampaignCreate is the builder for creating a Campaign entity.

func (*CampaignCreate) Mutation

func (cc *CampaignCreate) Mutation() *CampaignMutation

Mutation returns the CampaignMutation object of the builder.

func (*CampaignCreate) Save

func (cc *CampaignCreate) Save(ctx context.Context) (*Campaign, error)

Save creates the Campaign in the database.

func (*CampaignCreate) SaveX

func (cc *CampaignCreate) SaveX(ctx context.Context) *Campaign

SaveX calls Save and panics if Save returns an error.

func (*CampaignCreate) SetID

func (cc *CampaignCreate) SetID(pu pulid.ID) *CampaignCreate

SetID sets the id field.

func (*CampaignCreate) SetName

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

SetName sets the name field.

type CampaignCreateBulk

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

CampaignCreateBulk is the builder for creating a bulk of Campaign entities.

func (*CampaignCreateBulk) Save

func (ccb *CampaignCreateBulk) Save(ctx context.Context) ([]*Campaign, error)

Save creates the Campaign entities in the database.

func (*CampaignCreateBulk) SaveX

func (ccb *CampaignCreateBulk) SaveX(ctx context.Context) []*Campaign

SaveX calls Save and panics if Save returns an error.

type CampaignDelete

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

CampaignDelete is the builder for deleting a Campaign entity.

func (*CampaignDelete) Exec

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

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

func (*CampaignDelete) ExecX

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

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

func (*CampaignDelete) Where

func (cd *CampaignDelete) Where(ps ...predicate.Campaign) *CampaignDelete

Where adds a new predicate to the delete builder.

type CampaignDeleteOne

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

CampaignDeleteOne is the builder for deleting a single Campaign entity.

func (*CampaignDeleteOne) Exec

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

Exec executes the deletion query.

func (*CampaignDeleteOne) ExecX

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

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

type CampaignEdge

type CampaignEdge struct {
	Node   *Campaign `json:"node"`
	Cursor Cursor    `json:"cursor"`
}

CampaignEdge is the edge representation of Campaign.

type CampaignGroupBy

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

CampaignGroupBy is the builder for group-by Campaign entities.

func (*CampaignGroupBy) Aggregate

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

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

func (*CampaignGroupBy) Bool

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

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

func (*CampaignGroupBy) BoolX

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

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

func (*CampaignGroupBy) Bools

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

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

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

func (*CampaignGroupBy) Float64

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

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

func (*CampaignGroupBy) Float64X

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

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

func (*CampaignGroupBy) Float64s

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

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

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

func (*CampaignGroupBy) Int

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

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

func (*CampaignGroupBy) IntX

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

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

func (*CampaignGroupBy) Ints

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

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

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

func (*CampaignGroupBy) Scan

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

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

func (*CampaignGroupBy) ScanX

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

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

func (*CampaignGroupBy) String

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

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

func (*CampaignGroupBy) StringX

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

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

func (*CampaignGroupBy) Strings

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

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

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

type CampaignMutation

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

CampaignMutation represents an operation that mutate the Campaigns nodes in the graph.

func (*CampaignMutation) AddField

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

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

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

func (*CampaignMutation) AddedField

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

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

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

func (*CampaignMutation) AddedIDs

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

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

func (*CampaignMutation) ClearEdge

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

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

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

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

func (*CampaignMutation) ClearedFields

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

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

func (CampaignMutation) Client

func (m CampaignMutation) 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 (*CampaignMutation) EdgeCleared

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

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

func (*CampaignMutation) Field

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

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

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

func (*CampaignMutation) Fields

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

func (m *CampaignMutation) ID() (id pulid.ID, 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 (*CampaignMutation) Name

func (m *CampaignMutation) Name() (r string, exists bool)

Name returns the name value in the mutation.

func (*CampaignMutation) OldField

func (m *CampaignMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database was failed.

func (*CampaignMutation) OldName

func (m *CampaignMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old name value of the Campaign. If the Campaign object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or database query fails.

func (*CampaignMutation) Op

func (m *CampaignMutation) Op() Op

Op returns the operation name.

func (*CampaignMutation) RemovedEdges

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

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

func (*CampaignMutation) RemovedIDs

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

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

func (*CampaignMutation) ResetEdge

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

func (m *CampaignMutation) 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 (*CampaignMutation) ResetName

func (m *CampaignMutation) ResetName()

ResetName reset all changes of the "name" field.

func (*CampaignMutation) SetField

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

func (m *CampaignMutation) SetID(id pulid.ID)

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

func (*CampaignMutation) SetName

func (m *CampaignMutation) SetName(s string)

SetName sets the name field.

func (CampaignMutation) Tx

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

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

func (*CampaignMutation) Type

func (m *CampaignMutation) Type() string

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

type CampaignOrder

type CampaignOrder struct {
	Direction OrderDirection      `json:"direction"`
	Field     *CampaignOrderField `json:"field"`
}

CampaignOrder defines the ordering of Campaign.

type CampaignOrderField

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

CampaignOrderField defines the ordering field of Campaign.

type CampaignPaginateOption

type CampaignPaginateOption func(*campaignPager) error

CampaignPaginateOption enables pagination customization.

func WithCampaignFilter

func WithCampaignFilter(filter func(*CampaignQuery) (*CampaignQuery, error)) CampaignPaginateOption

WithCampaignFilter configures pagination filter.

func WithCampaignOrder

func WithCampaignOrder(order *CampaignOrder) CampaignPaginateOption

WithCampaignOrder configures pagination ordering.

type CampaignQuery

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

CampaignQuery is the builder for querying Campaign entities.

func (*CampaignQuery) All

func (cq *CampaignQuery) All(ctx context.Context) ([]*Campaign, error)

All executes the query and returns a list of Campaigns.

func (*CampaignQuery) AllX

func (cq *CampaignQuery) AllX(ctx context.Context) []*Campaign

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

func (*CampaignQuery) Clone

func (cq *CampaignQuery) Clone() *CampaignQuery

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 (*CampaignQuery) CollectFields

func (c *CampaignQuery) CollectFields(ctx context.Context, satisfies ...string) *CampaignQuery

CollectFields tells the query-builder to eagerly load connected nodes by resolver context.

func (*CampaignQuery) Count

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

Count returns the count of the given query.

func (*CampaignQuery) CountX

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

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

func (*CampaignQuery) Exist

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

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

func (*CampaignQuery) ExistX

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

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

func (*CampaignQuery) First

func (cq *CampaignQuery) First(ctx context.Context) (*Campaign, error)

First returns the first Campaign entity in the query. Returns *NotFoundError when no campaign was found.

func (*CampaignQuery) FirstID

func (cq *CampaignQuery) FirstID(ctx context.Context) (id pulid.ID, err error)

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

func (*CampaignQuery) FirstIDX

func (cq *CampaignQuery) FirstIDX(ctx context.Context) pulid.ID

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

func (*CampaignQuery) FirstX

func (cq *CampaignQuery) FirstX(ctx context.Context) *Campaign

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

func (*CampaignQuery) GroupBy

func (cq *CampaignQuery) GroupBy(field string, fields ...string) *CampaignGroupBy

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.Campaign.Query().
	GroupBy(campaign.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*CampaignQuery) IDs

func (cq *CampaignQuery) IDs(ctx context.Context) ([]pulid.ID, error)

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

func (*CampaignQuery) IDsX

func (cq *CampaignQuery) IDsX(ctx context.Context) []pulid.ID

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

func (*CampaignQuery) Limit

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

Limit adds a limit step to the query.

func (*CampaignQuery) Offset

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

Offset adds an offset step to the query.

func (*CampaignQuery) Only

func (cq *CampaignQuery) Only(ctx context.Context) (*Campaign, error)

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

func (*CampaignQuery) OnlyID

func (cq *CampaignQuery) OnlyID(ctx context.Context) (id pulid.ID, err error)

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

func (*CampaignQuery) OnlyIDX

func (cq *CampaignQuery) OnlyIDX(ctx context.Context) pulid.ID

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

func (*CampaignQuery) OnlyX

func (cq *CampaignQuery) OnlyX(ctx context.Context) *Campaign

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

func (*CampaignQuery) Order

func (cq *CampaignQuery) Order(o ...OrderFunc) *CampaignQuery

Order adds an order step to the query.

func (*CampaignQuery) Paginate

func (c *CampaignQuery) Paginate(
	ctx context.Context, after *Cursor, first *int,
	before *Cursor, last *int, opts ...CampaignPaginateOption,
) (*CampaignConnection, error)

Paginate executes the query and returns a relay based cursor connection to Campaign.

func (*CampaignQuery) Select

func (cq *CampaignQuery) Select(field string, fields ...string) *CampaignSelect

Select one or more fields from the given query.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
}

client.Campaign.Query().
	Select(campaign.FieldName).
	Scan(ctx, &v)

func (*CampaignQuery) Where

func (cq *CampaignQuery) Where(ps ...predicate.Campaign) *CampaignQuery

Where adds a new predicate for the builder.

type CampaignSelect

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

CampaignSelect is the builder for select fields of Campaign entities.

func (*CampaignSelect) Bool

func (cs *CampaignSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*CampaignSelect) BoolX

func (cs *CampaignSelect) BoolX(ctx context.Context) bool

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

func (*CampaignSelect) Bools

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

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

func (*CampaignSelect) BoolsX

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

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

func (*CampaignSelect) Float64

func (cs *CampaignSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*CampaignSelect) Float64X

func (cs *CampaignSelect) Float64X(ctx context.Context) float64

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

func (*CampaignSelect) Float64s

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

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

func (*CampaignSelect) Float64sX

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

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

func (*CampaignSelect) Int

func (cs *CampaignSelect) Int(ctx context.Context) (_ int, err error)

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

func (*CampaignSelect) IntX

func (cs *CampaignSelect) IntX(ctx context.Context) int

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

func (*CampaignSelect) Ints

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

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

func (*CampaignSelect) IntsX

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

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

func (*CampaignSelect) Scan

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

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

func (*CampaignSelect) ScanX

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

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

func (*CampaignSelect) String

func (cs *CampaignSelect) String(ctx context.Context) (_ string, err error)

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

func (*CampaignSelect) StringX

func (cs *CampaignSelect) StringX(ctx context.Context) string

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

func (*CampaignSelect) Strings

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

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

func (*CampaignSelect) StringsX

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

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

type CampaignUpdate

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

CampaignUpdate is the builder for updating Campaign entities.

func (*CampaignUpdate) Exec

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

Exec executes the query.

func (*CampaignUpdate) ExecX

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

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

func (*CampaignUpdate) Mutation

func (cu *CampaignUpdate) Mutation() *CampaignMutation

Mutation returns the CampaignMutation object of the builder.

func (*CampaignUpdate) Save

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

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

func (*CampaignUpdate) SaveX

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

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

func (*CampaignUpdate) SetName

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

SetName sets the name field.

func (*CampaignUpdate) Where

func (cu *CampaignUpdate) Where(ps ...predicate.Campaign) *CampaignUpdate

Where adds a new predicate for the builder.

type CampaignUpdateOne

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

CampaignUpdateOne is the builder for updating a single Campaign entity.

func (*CampaignUpdateOne) Exec

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

Exec executes the query on the entity.

func (*CampaignUpdateOne) ExecX

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

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

func (*CampaignUpdateOne) Mutation

func (cuo *CampaignUpdateOne) Mutation() *CampaignMutation

Mutation returns the CampaignMutation object of the builder.

func (*CampaignUpdateOne) Save

func (cuo *CampaignUpdateOne) Save(ctx context.Context) (*Campaign, error)

Save executes the query and returns the updated entity.

func (*CampaignUpdateOne) SaveX

func (cuo *CampaignUpdateOne) SaveX(ctx context.Context) *Campaign

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

func (*CampaignUpdateOne) SetName

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

SetName sets the name field.

type Campaigns

type Campaigns []*Campaign

Campaigns is a parsable slice of Campaign.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Account is the client for interacting with the Account builders.
	Account *AccountClient
	// Campaign is the client for interacting with the Campaign builders.
	Campaign *CampaignClient
	// Organization is the client for interacting with the Organization builders.
	Organization *OrganizationClient
	// contains filtered or unexported fields
}

Client is the client that holds all ent builders.

func FromContext

func FromContext(ctx context.Context) *Client

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

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new client configured with the given options.

func Open

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

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

func (*Client) BeginTx

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

BeginTx returns a transactional client with options.

func (*Client) Close

func (c *Client) Close() error

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

func (*Client) Debug

func (c *Client) Debug() *Client

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

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

func (*Client) Node

func (c *Client) Node(ctx context.Context, id pulid.ID) (*Node, error)

func (*Client) Noder

func (c *Client) Noder(ctx context.Context, id pulid.ID, opts ...NodeOption) (_ Noder, err error)

Noder returns a Node by its id. If the NodeType was not provided, it will be derived from the id value according to the universal-id configuration.

c.Noder(ctx, id)
c.Noder(ctx, id, ent.WithNodeType(pet.Table))

func (*Client) Noders

func (c *Client) Noders(ctx context.Context, ids []pulid.ID, opts ...NodeOption) ([]Noder, error)

func (*Client) OpenTx

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

OpenTx opens a transaction and returns a transactional context along with the created transaction.

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

type CommitFunc func(context.Context, *Tx) error

The CommitFunc type is an adapter to allow the use of ordinary function as a Committer. If f is a function with the appropriate signature, CommitFunc(f) is a Committer that calls f.

func (CommitFunc) Commit

func (f CommitFunc) Commit(ctx context.Context, tx *Tx) error

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

CommitHook defines the "commit middleware". A function that gets a Committer and returns a Committer. For example:

hook := func(next ent.Committer) ent.Committer {
	return ent.CommitFunc(func(context.Context, tx *ent.Tx) error {
		// Do some stuff before.
		if err := next.Commit(ctx, tx); err != nil {
			return err
		}
		// Do some stuff after.
		return nil
	})
}

type Committer

type Committer interface {
	Commit(context.Context, *Tx) error
}

Committer is the interface that wraps the Committer method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Cursor

type Cursor struct {
	ID    pulid.ID `msgpack:"i"`
	Value Value    `msgpack:"v,omitempty"`
}

Cursor of an edge type.

func (Cursor) MarshalGQL

func (c Cursor) MarshalGQL(w io.Writer)

MarshalGQL implements graphql.Marshaler interface.

func (*Cursor) UnmarshalGQL

func (c *Cursor) UnmarshalGQL(v interface{}) error

UnmarshalGQL implements graphql.Unmarshaler interface.

type Edge

type Edge struct {
	Type string     `json:"type,omitempty"` // edge type.
	Name string     `json:"name,omitempty"` // edge name.
	IDs  []pulid.ID `json:"ids,omitempty"`  // node ids (where this edge point to).
}

Edges between two nodes.

type Field

type Field struct {
	Type  string `json:"type,omitempty"`  // field type.
	Name  string `json:"name,omitempty"`  // field name (as in struct).
	Value string `json:"value,omitempty"` // stringified value.
}

Field of a node.

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 Node

type Node struct {
	ID     pulid.ID `json:"id,omitempty"`     // node id.
	Type   string   `json:"type,omitempty"`   // node type.
	Fields []*Field `json:"fields,omitempty"` // node fields.
	Edges  []*Edge  `json:"edges,omitempty"`  // node edges.
}

Node in the graph.

type NodeOption

type NodeOption func(*nodeOptions)

NodeOption allows configuring the Noder execution using functional options.

func WithFixedNodeType

func WithFixedNodeType(t string) NodeOption

WithFixedNodeType sets the Type of the node to a fixed value.

func WithNodeType

func WithNodeType(f func(context.Context, pulid.ID) (string, error)) NodeOption

WithNodeType sets the node Type resolver function (i.e. the table to query). If was not provided, the table will be derived from the universal-id configuration as described in: https://entgo.io/docs/migrate/#universal-ids.

type Noder

type Noder interface {
	Node(context.Context) (*Node, error)
}

Noder wraps the basic Node method.

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 OrderDirection

type OrderDirection string

OrderDirection defines the directions in which to order a list of items.

const (
	// OrderDirectionAsc specifies an ascending order.
	OrderDirectionAsc OrderDirection = "ASC"
	// OrderDirectionDesc specifies a descending order.
	OrderDirectionDesc OrderDirection = "DESC"
)

func (OrderDirection) MarshalGQL

func (o OrderDirection) MarshalGQL(w io.Writer)

MarshalGQL implements graphql.Marshaler interface.

func (OrderDirection) String

func (o OrderDirection) String() string

String implements fmt.Stringer interface.

func (*OrderDirection) UnmarshalGQL

func (o *OrderDirection) UnmarshalGQL(val interface{}) error

UnmarshalGQL implements graphql.Unmarshaler interface.

func (OrderDirection) Validate

func (o OrderDirection) Validate() error

Validate the order direction value.

type OrderFunc

type OrderFunc func(*sql.Selector, func(string) bool)

OrderFunc applies an ordering on the sql selector.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Organization

type Organization struct {

	// ID of the ent.
	ID pulid.ID `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the OrganizationQuery when eager-loading is set.
	Edges OrganizationEdges `json:"edges"`
	// contains filtered or unexported fields
}

Organization is the model entity for the Organization schema.

func (*Organization) Accounts

func (o *Organization) Accounts(ctx context.Context) ([]*Account, error)

func (*Organization) Campaigns

func (o *Organization) Campaigns(ctx context.Context) ([]*Campaign, error)

func (*Organization) Node

func (o *Organization) Node(ctx context.Context) (node *Node, err error)

func (*Organization) QueryAccounts

func (o *Organization) QueryAccounts() *AccountQuery

QueryAccounts queries the accounts edge of the Organization.

func (*Organization) QueryCampaigns

func (o *Organization) QueryCampaigns() *CampaignQuery

QueryCampaigns queries the campaigns edge of the Organization.

func (*Organization) String

func (o *Organization) String() string

String implements the fmt.Stringer.

func (*Organization) ToEdge

func (o *Organization) ToEdge(order *OrganizationOrder) *OrganizationEdge

ToEdge converts Organization into OrganizationEdge.

func (*Organization) Unwrap

func (o *Organization) Unwrap() *Organization

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

func (o *Organization) Update() *OrganizationUpdateOne

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

type OrganizationClient

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

OrganizationClient is a client for the Organization schema.

func NewOrganizationClient

func NewOrganizationClient(c config) *OrganizationClient

NewOrganizationClient returns a client for the Organization from the given config.

func (*OrganizationClient) Create

Create returns a create builder for Organization.

func (*OrganizationClient) CreateBulk

func (c *OrganizationClient) CreateBulk(builders ...*OrganizationCreate) *OrganizationCreateBulk

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

func (*OrganizationClient) Delete

Delete returns a delete builder for Organization.

func (*OrganizationClient) DeleteOne

DeleteOne returns a delete builder for the given entity.

func (*OrganizationClient) DeleteOneID

func (c *OrganizationClient) DeleteOneID(id pulid.ID) *OrganizationDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*OrganizationClient) Get

Get returns a Organization entity by its id.

func (*OrganizationClient) GetX

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

func (*OrganizationClient) Hooks

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

Hooks returns the client hooks.

func (*OrganizationClient) Query

Query returns a query builder for Organization.

func (*OrganizationClient) QueryAccounts

func (c *OrganizationClient) QueryAccounts(o *Organization) *AccountQuery

QueryAccounts queries the accounts edge of a Organization.

func (*OrganizationClient) QueryCampaigns

func (c *OrganizationClient) QueryCampaigns(o *Organization) *CampaignQuery

QueryCampaigns queries the campaigns edge of a Organization.

func (*OrganizationClient) Update

Update returns an update builder for Organization.

func (*OrganizationClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*OrganizationClient) UpdateOneID

func (c *OrganizationClient) UpdateOneID(id pulid.ID) *OrganizationUpdateOne

UpdateOneID returns an update builder for the given id.

func (*OrganizationClient) Use

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

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

type OrganizationConnection

type OrganizationConnection struct {
	Edges      []*OrganizationEdge `json:"edges"`
	PageInfo   PageInfo            `json:"pageInfo"`
	TotalCount int                 `json:"totalCount"`
}

OrganizationConnection is the connection containing edges to Organization.

type OrganizationCreate

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

OrganizationCreate is the builder for creating a Organization entity.

func (*OrganizationCreate) AddAccountIDs

func (oc *OrganizationCreate) AddAccountIDs(ids ...pulid.ID) *OrganizationCreate

AddAccountIDs adds the accounts edge to Account by ids.

func (*OrganizationCreate) AddAccounts

func (oc *OrganizationCreate) AddAccounts(a ...*Account) *OrganizationCreate

AddAccounts adds the accounts edges to Account.

func (*OrganizationCreate) AddCampaignIDs

func (oc *OrganizationCreate) AddCampaignIDs(ids ...pulid.ID) *OrganizationCreate

AddCampaignIDs adds the campaigns edge to Campaign by ids.

func (*OrganizationCreate) AddCampaigns

func (oc *OrganizationCreate) AddCampaigns(c ...*Campaign) *OrganizationCreate

AddCampaigns adds the campaigns edges to Campaign.

func (*OrganizationCreate) Mutation

func (oc *OrganizationCreate) Mutation() *OrganizationMutation

Mutation returns the OrganizationMutation object of the builder.

func (*OrganizationCreate) Save

Save creates the Organization in the database.

func (*OrganizationCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*OrganizationCreate) SetID

SetID sets the id field.

func (*OrganizationCreate) SetName

SetName sets the name field.

type OrganizationCreateBulk

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

OrganizationCreateBulk is the builder for creating a bulk of Organization entities.

func (*OrganizationCreateBulk) Save

Save creates the Organization entities in the database.

func (*OrganizationCreateBulk) SaveX

SaveX calls Save and panics if Save returns an error.

type OrganizationDelete

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

OrganizationDelete is the builder for deleting a Organization entity.

func (*OrganizationDelete) Exec

func (od *OrganizationDelete) Exec(ctx context.Context) (int, error)

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

func (*OrganizationDelete) ExecX

func (od *OrganizationDelete) ExecX(ctx context.Context) int

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

func (*OrganizationDelete) Where

Where adds a new predicate to the delete builder.

type OrganizationDeleteOne

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

OrganizationDeleteOne is the builder for deleting a single Organization entity.

func (*OrganizationDeleteOne) Exec

func (odo *OrganizationDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*OrganizationDeleteOne) ExecX

func (odo *OrganizationDeleteOne) ExecX(ctx context.Context)

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

type OrganizationEdge

type OrganizationEdge struct {
	Node   *Organization `json:"node"`
	Cursor Cursor        `json:"cursor"`
}

OrganizationEdge is the edge representation of Organization.

type OrganizationEdges

type OrganizationEdges struct {
	// Accounts holds the value of the accounts edge.
	Accounts []*Account
	// Campaigns holds the value of the campaigns edge.
	Campaigns []*Campaign
	// contains filtered or unexported fields
}

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

func (OrganizationEdges) AccountsOrErr

func (e OrganizationEdges) AccountsOrErr() ([]*Account, error)

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

func (OrganizationEdges) CampaignsOrErr

func (e OrganizationEdges) CampaignsOrErr() ([]*Campaign, error)

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

type OrganizationGroupBy

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

OrganizationGroupBy is the builder for group-by Organization entities.

func (*OrganizationGroupBy) Aggregate

func (ogb *OrganizationGroupBy) Aggregate(fns ...AggregateFunc) *OrganizationGroupBy

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

func (*OrganizationGroupBy) Bool

func (ogb *OrganizationGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*OrganizationGroupBy) BoolX

func (ogb *OrganizationGroupBy) BoolX(ctx context.Context) bool

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

func (*OrganizationGroupBy) Bools

func (ogb *OrganizationGroupBy) 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 (*OrganizationGroupBy) BoolsX

func (ogb *OrganizationGroupBy) BoolsX(ctx context.Context) []bool

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

func (*OrganizationGroupBy) Float64

func (ogb *OrganizationGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*OrganizationGroupBy) Float64X

func (ogb *OrganizationGroupBy) Float64X(ctx context.Context) float64

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

func (*OrganizationGroupBy) Float64s

func (ogb *OrganizationGroupBy) 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 (*OrganizationGroupBy) Float64sX

func (ogb *OrganizationGroupBy) Float64sX(ctx context.Context) []float64

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

func (*OrganizationGroupBy) Int

func (ogb *OrganizationGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*OrganizationGroupBy) IntX

func (ogb *OrganizationGroupBy) IntX(ctx context.Context) int

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

func (*OrganizationGroupBy) Ints

func (ogb *OrganizationGroupBy) 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 (*OrganizationGroupBy) IntsX

func (ogb *OrganizationGroupBy) IntsX(ctx context.Context) []int

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

func (*OrganizationGroupBy) Scan

func (ogb *OrganizationGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*OrganizationGroupBy) ScanX

func (ogb *OrganizationGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*OrganizationGroupBy) String

func (ogb *OrganizationGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*OrganizationGroupBy) StringX

func (ogb *OrganizationGroupBy) StringX(ctx context.Context) string

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

func (*OrganizationGroupBy) Strings

func (ogb *OrganizationGroupBy) 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 (*OrganizationGroupBy) StringsX

func (ogb *OrganizationGroupBy) StringsX(ctx context.Context) []string

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

type OrganizationMutation

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

OrganizationMutation represents an operation that mutate the Organizations nodes in the graph.

func (*OrganizationMutation) AccountsCleared

func (m *OrganizationMutation) AccountsCleared() bool

AccountsCleared returns if the edge accounts was cleared.

func (*OrganizationMutation) AccountsIDs

func (m *OrganizationMutation) AccountsIDs() (ids []pulid.ID)

AccountsIDs returns the accounts ids in the mutation.

func (*OrganizationMutation) AddAccountIDs

func (m *OrganizationMutation) AddAccountIDs(ids ...pulid.ID)

AddAccountIDs adds the accounts edge to Account by ids.

func (*OrganizationMutation) AddCampaignIDs

func (m *OrganizationMutation) AddCampaignIDs(ids ...pulid.ID)

AddCampaignIDs adds the campaigns edge to Campaign by ids.

func (*OrganizationMutation) AddField

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

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

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

func (*OrganizationMutation) AddedField

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

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

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

func (*OrganizationMutation) AddedIDs

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

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

func (*OrganizationMutation) CampaignsCleared

func (m *OrganizationMutation) CampaignsCleared() bool

CampaignsCleared returns if the edge campaigns was cleared.

func (*OrganizationMutation) CampaignsIDs

func (m *OrganizationMutation) CampaignsIDs() (ids []pulid.ID)

CampaignsIDs returns the campaigns ids in the mutation.

func (*OrganizationMutation) ClearAccounts

func (m *OrganizationMutation) ClearAccounts()

ClearAccounts clears the accounts edge to Account.

func (*OrganizationMutation) ClearCampaigns

func (m *OrganizationMutation) ClearCampaigns()

ClearCampaigns clears the campaigns edge to Campaign.

func (*OrganizationMutation) ClearEdge

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

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

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

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

func (*OrganizationMutation) ClearedFields

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

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

func (OrganizationMutation) Client

func (m OrganizationMutation) 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 (*OrganizationMutation) EdgeCleared

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

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

func (*OrganizationMutation) Field

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

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

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

func (*OrganizationMutation) Fields

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

func (m *OrganizationMutation) ID() (id pulid.ID, 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 (*OrganizationMutation) Name

func (m *OrganizationMutation) Name() (r string, exists bool)

Name returns the name value in the mutation.

func (*OrganizationMutation) OldField

func (m *OrganizationMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database was failed.

func (*OrganizationMutation) OldName

func (m *OrganizationMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old name value of the Organization. If the Organization object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or database query fails.

func (*OrganizationMutation) Op

func (m *OrganizationMutation) Op() Op

Op returns the operation name.

func (*OrganizationMutation) RemoveAccountIDs

func (m *OrganizationMutation) RemoveAccountIDs(ids ...pulid.ID)

RemoveAccountIDs removes the accounts edge to Account by ids.

func (*OrganizationMutation) RemoveCampaignIDs

func (m *OrganizationMutation) RemoveCampaignIDs(ids ...pulid.ID)

RemoveCampaignIDs removes the campaigns edge to Campaign by ids.

func (*OrganizationMutation) RemovedAccountsIDs

func (m *OrganizationMutation) RemovedAccountsIDs() (ids []pulid.ID)

RemovedAccounts returns the removed ids of accounts.

func (*OrganizationMutation) RemovedCampaignsIDs

func (m *OrganizationMutation) RemovedCampaignsIDs() (ids []pulid.ID)

RemovedCampaigns returns the removed ids of campaigns.

func (*OrganizationMutation) RemovedEdges

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

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

func (*OrganizationMutation) RemovedIDs

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

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

func (*OrganizationMutation) ResetAccounts

func (m *OrganizationMutation) ResetAccounts()

ResetAccounts reset all changes of the "accounts" edge.

func (*OrganizationMutation) ResetCampaigns

func (m *OrganizationMutation) ResetCampaigns()

ResetCampaigns reset all changes of the "campaigns" edge.

func (*OrganizationMutation) ResetEdge

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

func (m *OrganizationMutation) 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 (*OrganizationMutation) ResetName

func (m *OrganizationMutation) ResetName()

ResetName reset all changes of the "name" field.

func (*OrganizationMutation) SetField

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

func (m *OrganizationMutation) SetID(id pulid.ID)

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

func (*OrganizationMutation) SetName

func (m *OrganizationMutation) SetName(s string)

SetName sets the name field.

func (OrganizationMutation) Tx

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

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

func (*OrganizationMutation) Type

func (m *OrganizationMutation) Type() string

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

type OrganizationOrder

type OrganizationOrder struct {
	Direction OrderDirection          `json:"direction"`
	Field     *OrganizationOrderField `json:"field"`
}

OrganizationOrder defines the ordering of Organization.

type OrganizationOrderField

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

OrganizationOrderField defines the ordering field of Organization.

type OrganizationPaginateOption

type OrganizationPaginateOption func(*organizationPager) error

OrganizationPaginateOption enables pagination customization.

func WithOrganizationFilter

func WithOrganizationFilter(filter func(*OrganizationQuery) (*OrganizationQuery, error)) OrganizationPaginateOption

WithOrganizationFilter configures pagination filter.

func WithOrganizationOrder

func WithOrganizationOrder(order *OrganizationOrder) OrganizationPaginateOption

WithOrganizationOrder configures pagination ordering.

type OrganizationQuery

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

OrganizationQuery is the builder for querying Organization entities.

func (*OrganizationQuery) All

func (oq *OrganizationQuery) All(ctx context.Context) ([]*Organization, error)

All executes the query and returns a list of Organizations.

func (*OrganizationQuery) AllX

func (oq *OrganizationQuery) AllX(ctx context.Context) []*Organization

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

func (*OrganizationQuery) Clone

func (oq *OrganizationQuery) Clone() *OrganizationQuery

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 (*OrganizationQuery) CollectFields

func (o *OrganizationQuery) CollectFields(ctx context.Context, satisfies ...string) *OrganizationQuery

CollectFields tells the query-builder to eagerly load connected nodes by resolver context.

func (*OrganizationQuery) Count

func (oq *OrganizationQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*OrganizationQuery) CountX

func (oq *OrganizationQuery) CountX(ctx context.Context) int

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

func (*OrganizationQuery) Exist

func (oq *OrganizationQuery) Exist(ctx context.Context) (bool, error)

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

func (*OrganizationQuery) ExistX

func (oq *OrganizationQuery) ExistX(ctx context.Context) bool

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

func (*OrganizationQuery) First

func (oq *OrganizationQuery) First(ctx context.Context) (*Organization, error)

First returns the first Organization entity in the query. Returns *NotFoundError when no organization was found.

func (*OrganizationQuery) FirstID

func (oq *OrganizationQuery) FirstID(ctx context.Context) (id pulid.ID, err error)

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

func (*OrganizationQuery) FirstIDX

func (oq *OrganizationQuery) FirstIDX(ctx context.Context) pulid.ID

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

func (*OrganizationQuery) FirstX

func (oq *OrganizationQuery) FirstX(ctx context.Context) *Organization

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

func (*OrganizationQuery) GroupBy

func (oq *OrganizationQuery) GroupBy(field string, fields ...string) *OrganizationGroupBy

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.Organization.Query().
	GroupBy(organization.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*OrganizationQuery) IDs

func (oq *OrganizationQuery) IDs(ctx context.Context) ([]pulid.ID, error)

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

func (*OrganizationQuery) IDsX

func (oq *OrganizationQuery) IDsX(ctx context.Context) []pulid.ID

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

func (*OrganizationQuery) Limit

func (oq *OrganizationQuery) Limit(limit int) *OrganizationQuery

Limit adds a limit step to the query.

func (*OrganizationQuery) Offset

func (oq *OrganizationQuery) Offset(offset int) *OrganizationQuery

Offset adds an offset step to the query.

func (*OrganizationQuery) Only

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

func (*OrganizationQuery) OnlyID

func (oq *OrganizationQuery) OnlyID(ctx context.Context) (id pulid.ID, err error)

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

func (*OrganizationQuery) OnlyIDX

func (oq *OrganizationQuery) OnlyIDX(ctx context.Context) pulid.ID

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

func (*OrganizationQuery) OnlyX

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

func (*OrganizationQuery) Order

Order adds an order step to the query.

func (*OrganizationQuery) Paginate

func (o *OrganizationQuery) Paginate(
	ctx context.Context, after *Cursor, first *int,
	before *Cursor, last *int, opts ...OrganizationPaginateOption,
) (*OrganizationConnection, error)

Paginate executes the query and returns a relay based cursor connection to Organization.

func (*OrganizationQuery) QueryAccounts

func (oq *OrganizationQuery) QueryAccounts() *AccountQuery

QueryAccounts chains the current query on the accounts edge.

func (*OrganizationQuery) QueryCampaigns

func (oq *OrganizationQuery) QueryCampaigns() *CampaignQuery

QueryCampaigns chains the current query on the campaigns edge.

func (*OrganizationQuery) Select

func (oq *OrganizationQuery) Select(field string, fields ...string) *OrganizationSelect

Select one or more fields from the given query.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
}

client.Organization.Query().
	Select(organization.FieldName).
	Scan(ctx, &v)

func (*OrganizationQuery) Where

Where adds a new predicate for the builder.

func (*OrganizationQuery) WithAccounts

func (oq *OrganizationQuery) WithAccounts(opts ...func(*AccountQuery)) *OrganizationQuery
WithAccounts tells the query-builder to eager-loads the nodes that are connected to

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

func (*OrganizationQuery) WithCampaigns

func (oq *OrganizationQuery) WithCampaigns(opts ...func(*CampaignQuery)) *OrganizationQuery
WithCampaigns tells the query-builder to eager-loads the nodes that are connected to

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

type OrganizationSelect

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

OrganizationSelect is the builder for select fields of Organization entities.

func (*OrganizationSelect) Bool

func (os *OrganizationSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*OrganizationSelect) BoolX

func (os *OrganizationSelect) BoolX(ctx context.Context) bool

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

func (*OrganizationSelect) Bools

func (os *OrganizationSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*OrganizationSelect) BoolsX

func (os *OrganizationSelect) BoolsX(ctx context.Context) []bool

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

func (*OrganizationSelect) Float64

func (os *OrganizationSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*OrganizationSelect) Float64X

func (os *OrganizationSelect) Float64X(ctx context.Context) float64

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

func (*OrganizationSelect) Float64s

func (os *OrganizationSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*OrganizationSelect) Float64sX

func (os *OrganizationSelect) Float64sX(ctx context.Context) []float64

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

func (*OrganizationSelect) Int

func (os *OrganizationSelect) Int(ctx context.Context) (_ int, err error)

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

func (*OrganizationSelect) IntX

func (os *OrganizationSelect) IntX(ctx context.Context) int

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

func (*OrganizationSelect) Ints

func (os *OrganizationSelect) Ints(ctx context.Context) ([]int, error)

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

func (*OrganizationSelect) IntsX

func (os *OrganizationSelect) IntsX(ctx context.Context) []int

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

func (*OrganizationSelect) Scan

func (os *OrganizationSelect) Scan(ctx context.Context, v interface{}) error

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

func (*OrganizationSelect) ScanX

func (os *OrganizationSelect) ScanX(ctx context.Context, v interface{})

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

func (*OrganizationSelect) String

func (os *OrganizationSelect) String(ctx context.Context) (_ string, err error)

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

func (*OrganizationSelect) StringX

func (os *OrganizationSelect) StringX(ctx context.Context) string

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

func (*OrganizationSelect) Strings

func (os *OrganizationSelect) Strings(ctx context.Context) ([]string, error)

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

func (*OrganizationSelect) StringsX

func (os *OrganizationSelect) StringsX(ctx context.Context) []string

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

type OrganizationUpdate

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

OrganizationUpdate is the builder for updating Organization entities.

func (*OrganizationUpdate) AddAccountIDs

func (ou *OrganizationUpdate) AddAccountIDs(ids ...pulid.ID) *OrganizationUpdate

AddAccountIDs adds the accounts edge to Account by ids.

func (*OrganizationUpdate) AddAccounts

func (ou *OrganizationUpdate) AddAccounts(a ...*Account) *OrganizationUpdate

AddAccounts adds the accounts edges to Account.

func (*OrganizationUpdate) AddCampaignIDs

func (ou *OrganizationUpdate) AddCampaignIDs(ids ...pulid.ID) *OrganizationUpdate

AddCampaignIDs adds the campaigns edge to Campaign by ids.

func (*OrganizationUpdate) AddCampaigns

func (ou *OrganizationUpdate) AddCampaigns(c ...*Campaign) *OrganizationUpdate

AddCampaigns adds the campaigns edges to Campaign.

func (*OrganizationUpdate) ClearAccounts

func (ou *OrganizationUpdate) ClearAccounts() *OrganizationUpdate

ClearAccounts clears all "accounts" edges to type Account.

func (*OrganizationUpdate) ClearCampaigns

func (ou *OrganizationUpdate) ClearCampaigns() *OrganizationUpdate

ClearCampaigns clears all "campaigns" edges to type Campaign.

func (*OrganizationUpdate) Exec

func (ou *OrganizationUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*OrganizationUpdate) ExecX

func (ou *OrganizationUpdate) ExecX(ctx context.Context)

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

func (*OrganizationUpdate) Mutation

func (ou *OrganizationUpdate) Mutation() *OrganizationMutation

Mutation returns the OrganizationMutation object of the builder.

func (*OrganizationUpdate) RemoveAccountIDs

func (ou *OrganizationUpdate) RemoveAccountIDs(ids ...pulid.ID) *OrganizationUpdate

RemoveAccountIDs removes the accounts edge to Account by ids.

func (*OrganizationUpdate) RemoveAccounts

func (ou *OrganizationUpdate) RemoveAccounts(a ...*Account) *OrganizationUpdate

RemoveAccounts removes accounts edges to Account.

func (*OrganizationUpdate) RemoveCampaignIDs

func (ou *OrganizationUpdate) RemoveCampaignIDs(ids ...pulid.ID) *OrganizationUpdate

RemoveCampaignIDs removes the campaigns edge to Campaign by ids.

func (*OrganizationUpdate) RemoveCampaigns

func (ou *OrganizationUpdate) RemoveCampaigns(c ...*Campaign) *OrganizationUpdate

RemoveCampaigns removes campaigns edges to Campaign.

func (*OrganizationUpdate) Save

func (ou *OrganizationUpdate) Save(ctx context.Context) (int, error)

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

func (*OrganizationUpdate) SaveX

func (ou *OrganizationUpdate) SaveX(ctx context.Context) int

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

func (*OrganizationUpdate) SetName

SetName sets the name field.

func (*OrganizationUpdate) Where

Where adds a new predicate for the builder.

type OrganizationUpdateOne

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

OrganizationUpdateOne is the builder for updating a single Organization entity.

func (*OrganizationUpdateOne) AddAccountIDs

func (ouo *OrganizationUpdateOne) AddAccountIDs(ids ...pulid.ID) *OrganizationUpdateOne

AddAccountIDs adds the accounts edge to Account by ids.

func (*OrganizationUpdateOne) AddAccounts

func (ouo *OrganizationUpdateOne) AddAccounts(a ...*Account) *OrganizationUpdateOne

AddAccounts adds the accounts edges to Account.

func (*OrganizationUpdateOne) AddCampaignIDs

func (ouo *OrganizationUpdateOne) AddCampaignIDs(ids ...pulid.ID) *OrganizationUpdateOne

AddCampaignIDs adds the campaigns edge to Campaign by ids.

func (*OrganizationUpdateOne) AddCampaigns

func (ouo *OrganizationUpdateOne) AddCampaigns(c ...*Campaign) *OrganizationUpdateOne

AddCampaigns adds the campaigns edges to Campaign.

func (*OrganizationUpdateOne) ClearAccounts

func (ouo *OrganizationUpdateOne) ClearAccounts() *OrganizationUpdateOne

ClearAccounts clears all "accounts" edges to type Account.

func (*OrganizationUpdateOne) ClearCampaigns

func (ouo *OrganizationUpdateOne) ClearCampaigns() *OrganizationUpdateOne

ClearCampaigns clears all "campaigns" edges to type Campaign.

func (*OrganizationUpdateOne) Exec

func (ouo *OrganizationUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*OrganizationUpdateOne) ExecX

func (ouo *OrganizationUpdateOne) ExecX(ctx context.Context)

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

func (*OrganizationUpdateOne) Mutation

Mutation returns the OrganizationMutation object of the builder.

func (*OrganizationUpdateOne) RemoveAccountIDs

func (ouo *OrganizationUpdateOne) RemoveAccountIDs(ids ...pulid.ID) *OrganizationUpdateOne

RemoveAccountIDs removes the accounts edge to Account by ids.

func (*OrganizationUpdateOne) RemoveAccounts

func (ouo *OrganizationUpdateOne) RemoveAccounts(a ...*Account) *OrganizationUpdateOne

RemoveAccounts removes accounts edges to Account.

func (*OrganizationUpdateOne) RemoveCampaignIDs

func (ouo *OrganizationUpdateOne) RemoveCampaignIDs(ids ...pulid.ID) *OrganizationUpdateOne

RemoveCampaignIDs removes the campaigns edge to Campaign by ids.

func (*OrganizationUpdateOne) RemoveCampaigns

func (ouo *OrganizationUpdateOne) RemoveCampaigns(c ...*Campaign) *OrganizationUpdateOne

RemoveCampaigns removes campaigns edges to Campaign.

func (*OrganizationUpdateOne) Save

Save executes the query and returns the updated entity.

func (*OrganizationUpdateOne) SaveX

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

func (*OrganizationUpdateOne) SetName

SetName sets the name field.

type Organizations

type Organizations []*Organization

Organizations is a parsable slice of Organization.

type PageInfo

type PageInfo struct {
	HasNextPage     bool    `json:"hasNextPage"`
	HasPreviousPage bool    `json:"hasPreviousPage"`
	StartCursor     *Cursor `json:"startCursor"`
	EndCursor       *Cursor `json:"endCursor"`
}

PageInfo of a connection type.

type Policy

type Policy = ent.Policy

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

type Query

type Query = ent.Query

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

type RollbackFunc

type RollbackFunc func(context.Context, *Tx) error

The RollbackFunc type is an adapter to allow the use of ordinary function as a Rollbacker. If f is a function with the appropriate signature, RollbackFunc(f) is a Rollbacker that calls f.

func (RollbackFunc) Rollback

func (f RollbackFunc) Rollback(ctx context.Context, tx *Tx) error

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

RollbackHook defines the "rollback middleware". A function that gets a Rollbacker and returns a Rollbacker. For example:

hook := func(next ent.Rollbacker) ent.Rollbacker {
	return ent.RollbackFunc(func(context.Context, tx *ent.Tx) error {
		// Do some stuff before.
		if err := next.Rollback(ctx, tx); err != nil {
			return err
		}
		// Do some stuff after.
		return nil
	})
}

type Rollbacker

type Rollbacker interface {
	Rollback(context.Context, *Tx) error
}

Rollbacker is the interface that wraps the Rollbacker method.

type Tx

type Tx struct {

	// Account is the client for interacting with the Account builders.
	Account *AccountClient
	// Campaign is the client for interacting with the Campaign builders.
	Campaign *CampaignClient
	// Organization is the client for interacting with the Organization builders.
	Organization *OrganizationClient
	// contains filtered or unexported fields
}

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

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

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

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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