ent

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsConstraintFailure

func IsConstraintFailure(err error) bool

IsConstraintFailure 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 IsNotSingular

func IsNotSingular(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks nor found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

Types

type Aggregate

type Aggregate struct {
	// SQL the column wrapped with the aggregation function.
	SQL func(*sql.Selector) string
}

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

func As

func As(fn Aggregate, end string) Aggregate

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

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

func Count

func Count() Aggregate

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

func Max

func Max(field string) Aggregate

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

func Mean

func Mean(field string) Aggregate

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

func Min

func Min(field string) Aggregate

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

func Sum

func Sum(field string) Aggregate

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

type Client

type Client struct {

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

Client is the client that holds all ent builders.

func FromContext

func FromContext(ctx context.Context) *Client

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

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new client configured with the given options.

func Open

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

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

func (*Client) Close

func (c *Client) Close() error

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

func (*Client) Debug

func (c *Client) Debug() *Client

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

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

func (*Client) Tx

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

Tx returns a new transactional client.

type ErrConstraintFailed

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

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

func (ErrConstraintFailed) Error

func (e ErrConstraintFailed) Error() string

Error implements the error interface.

func (*ErrConstraintFailed) Unwrap

func (e *ErrConstraintFailed) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type ErrNotFound

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

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

func (*ErrNotFound) Error

func (e *ErrNotFound) Error() string

Error implements the error interface.

type ErrNotSingular

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

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

func (*ErrNotSingular) Error

func (e *ErrNotSingular) Error() string

Error implements the error interface.

type Module

type Module struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Owner holds the value of the "owner" field.
	Owner string `json:"owner,omitempty"`
	// Namespace holds the value of the "namespace" field.
	Namespace string `json:"namespace,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Provider holds the value of the "provider" field.
	Provider string `json:"provider,omitempty"`
	// Description holds the value of the "description" field.
	Description string `json:"description,omitempty"`
	// Source holds the value of the "source" field.
	Source string `json:"source,omitempty"`
	// Downloads holds the value of the "downloads" field.
	Downloads int64 `json:"downloads,omitempty"`
	// PublishedAt holds the value of the "published_at" field.
	PublishedAt time.Time `json:"published_at,omitempty"`
	// InstallationID holds the value of the "installation_id" field.
	InstallationID int64 `json:"installation_id,omitempty"`
	// AppID holds the value of the "app_id" field.
	AppID int64 `json:"app_id,omitempty"`
	// RepoName holds the value of the "repo_name" field.
	RepoName string `json:"repo_name,omitempty"`
	// contains filtered or unexported fields
}

Module is the model entity for the Module schema.

Example
if dsn == "" {
	return
}
ctx := context.Background()
drv, err := sql.Open("mysql", dsn)
if err != nil {
	log.Fatalf("failed creating database client: %v", err)
}
defer drv.Close()
client := NewClient(Driver(drv))
// creating vertices for the module's edges.
mv0 := client.ModuleVersion.
	Create().
	SetMajor(1).
	SetMinor(1).
	SetPatch(1).
	SetTag("string").
	SaveX(ctx)
log.Println("moduleversion created:", mv0)

// create module vertex with its edges.
m := client.Module.
	Create().
	SetOwner("string").
	SetNamespace("string").
	SetName("string").
	SetProvider("string").
	SetDescription("string").
	SetSource("string").
	SetDownloads(1).
	SetPublishedAt(time.Now()).
	SetInstallationID(1).
	SetAppID(1).
	SetRepoName("string").
	AddVersion(mv0).
	SaveX(ctx)
log.Println("module created:", m)

// query edges.
mv0, err = m.QueryVersion().First(ctx)
if err != nil {
	log.Fatalf("failed querying version: %v", err)
}
log.Println("version found:", mv0)
Output:

func (*Module) FromRows

func (m *Module) FromRows(rows *sql.Rows) error

FromRows scans the sql response data into Module.

func (*Module) QueryVersion

func (m *Module) QueryVersion() *ModuleVersionQuery

QueryVersion queries the version edge of the Module.

func (*Module) String

func (m *Module) String() string

String implements the fmt.Stringer.

func (*Module) Unwrap

func (m *Module) Unwrap() *Module

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

func (m *Module) Update() *ModuleUpdateOne

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

type ModuleClient

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

ModuleClient is a client for the Module schema.

func NewModuleClient

func NewModuleClient(c config) *ModuleClient

NewModuleClient returns a client for the Module from the given config.

func (*ModuleClient) Create

func (c *ModuleClient) Create() *ModuleCreate

Create returns a create builder for Module.

func (*ModuleClient) Delete

func (c *ModuleClient) Delete() *ModuleDelete

Delete returns a delete builder for Module.

func (*ModuleClient) DeleteOne

func (c *ModuleClient) DeleteOne(m *Module) *ModuleDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*ModuleClient) DeleteOneID

func (c *ModuleClient) DeleteOneID(id int) *ModuleDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*ModuleClient) Get

func (c *ModuleClient) Get(ctx context.Context, id int) (*Module, error)

Get returns a Module entity by its id.

func (*ModuleClient) GetX

func (c *ModuleClient) GetX(ctx context.Context, id int) *Module

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

func (*ModuleClient) Query

func (c *ModuleClient) Query() *ModuleQuery

Create returns a query builder for Module.

func (*ModuleClient) QueryVersion

func (c *ModuleClient) QueryVersion(m *Module) *ModuleVersionQuery

QueryVersion queries the version edge of a Module.

func (*ModuleClient) Update

func (c *ModuleClient) Update() *ModuleUpdate

Update returns an update builder for Module.

func (*ModuleClient) UpdateOne

func (c *ModuleClient) UpdateOne(m *Module) *ModuleUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ModuleClient) UpdateOneID

func (c *ModuleClient) UpdateOneID(id int) *ModuleUpdateOne

UpdateOneID returns an update builder for the given id.

type ModuleCreate

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

ModuleCreate is the builder for creating a Module entity.

func (*ModuleCreate) AddVersion

func (mc *ModuleCreate) AddVersion(m ...*ModuleVersion) *ModuleCreate

AddVersion adds the version edges to ModuleVersion.

func (*ModuleCreate) AddVersionIDs

func (mc *ModuleCreate) AddVersionIDs(ids ...int) *ModuleCreate

AddVersionIDs adds the version edge to ModuleVersion by ids.

func (*ModuleCreate) Save

func (mc *ModuleCreate) Save(ctx context.Context) (*Module, error)

Save creates the Module in the database.

func (*ModuleCreate) SaveX

func (mc *ModuleCreate) SaveX(ctx context.Context) *Module

SaveX calls Save and panics if Save returns an error.

func (*ModuleCreate) SetAppID

func (mc *ModuleCreate) SetAppID(i int64) *ModuleCreate

SetAppID sets the app_id field.

func (*ModuleCreate) SetDescription

func (mc *ModuleCreate) SetDescription(s string) *ModuleCreate

SetDescription sets the description field.

func (*ModuleCreate) SetDownloads

func (mc *ModuleCreate) SetDownloads(i int64) *ModuleCreate

SetDownloads sets the downloads field.

func (*ModuleCreate) SetInstallationID

func (mc *ModuleCreate) SetInstallationID(i int64) *ModuleCreate

SetInstallationID sets the installation_id field.

func (*ModuleCreate) SetName

func (mc *ModuleCreate) SetName(s string) *ModuleCreate

SetName sets the name field.

func (*ModuleCreate) SetNamespace

func (mc *ModuleCreate) SetNamespace(s string) *ModuleCreate

SetNamespace sets the namespace field.

func (*ModuleCreate) SetNillableDownloads

func (mc *ModuleCreate) SetNillableDownloads(i *int64) *ModuleCreate

SetNillableDownloads sets the downloads field if the given value is not nil.

func (*ModuleCreate) SetOwner

func (mc *ModuleCreate) SetOwner(s string) *ModuleCreate

SetOwner sets the owner field.

func (*ModuleCreate) SetProvider

func (mc *ModuleCreate) SetProvider(s string) *ModuleCreate

SetProvider sets the provider field.

func (*ModuleCreate) SetPublishedAt

func (mc *ModuleCreate) SetPublishedAt(t time.Time) *ModuleCreate

SetPublishedAt sets the published_at field.

func (*ModuleCreate) SetRepoName

func (mc *ModuleCreate) SetRepoName(s string) *ModuleCreate

SetRepoName sets the repo_name field.

func (*ModuleCreate) SetSource

func (mc *ModuleCreate) SetSource(s string) *ModuleCreate

SetSource sets the source field.

type ModuleDelete

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

ModuleDelete is the builder for deleting a Module entity.

func (*ModuleDelete) Exec

func (md *ModuleDelete) Exec(ctx context.Context) (int, error)

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

func (*ModuleDelete) ExecX

func (md *ModuleDelete) ExecX(ctx context.Context) int

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

func (*ModuleDelete) Where

func (md *ModuleDelete) Where(ps ...predicate.Module) *ModuleDelete

Where adds a new predicate to the delete builder.

type ModuleDeleteOne

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

ModuleDeleteOne is the builder for deleting a single Module entity.

func (*ModuleDeleteOne) Exec

func (mdo *ModuleDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*ModuleDeleteOne) ExecX

func (mdo *ModuleDeleteOne) ExecX(ctx context.Context)

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

type ModuleGroupBy

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

ModuleGroupBy is the builder for group-by Module entities.

func (*ModuleGroupBy) Aggregate

func (mgb *ModuleGroupBy) Aggregate(fns ...Aggregate) *ModuleGroupBy

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

func (*ModuleGroupBy) Bools

func (mgb *ModuleGroupBy) 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 (*ModuleGroupBy) BoolsX

func (mgb *ModuleGroupBy) BoolsX(ctx context.Context) []bool

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

func (*ModuleGroupBy) Float64s

func (mgb *ModuleGroupBy) 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 (*ModuleGroupBy) Float64sX

func (mgb *ModuleGroupBy) Float64sX(ctx context.Context) []float64

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

func (*ModuleGroupBy) Ints

func (mgb *ModuleGroupBy) 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 (*ModuleGroupBy) IntsX

func (mgb *ModuleGroupBy) IntsX(ctx context.Context) []int

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

func (*ModuleGroupBy) Scan

func (mgb *ModuleGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*ModuleGroupBy) ScanX

func (mgb *ModuleGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*ModuleGroupBy) Strings

func (mgb *ModuleGroupBy) 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 (*ModuleGroupBy) StringsX

func (mgb *ModuleGroupBy) StringsX(ctx context.Context) []string

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

type ModuleQuery

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

ModuleQuery is the builder for querying Module entities.

func (*ModuleQuery) All

func (mq *ModuleQuery) All(ctx context.Context) ([]*Module, error)

All executes the query and returns a list of Modules.

func (*ModuleQuery) AllX

func (mq *ModuleQuery) AllX(ctx context.Context) []*Module

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

func (*ModuleQuery) Clone

func (mq *ModuleQuery) Clone() *ModuleQuery

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

func (mq *ModuleQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*ModuleQuery) CountX

func (mq *ModuleQuery) CountX(ctx context.Context) int

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

func (*ModuleQuery) Exist

func (mq *ModuleQuery) Exist(ctx context.Context) (bool, error)

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

func (*ModuleQuery) ExistX

func (mq *ModuleQuery) ExistX(ctx context.Context) bool

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

func (*ModuleQuery) First

func (mq *ModuleQuery) First(ctx context.Context) (*Module, error)

First returns the first Module entity in the query. Returns *ErrNotFound when no module was found.

func (*ModuleQuery) FirstID

func (mq *ModuleQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*ModuleQuery) FirstX

func (mq *ModuleQuery) FirstX(ctx context.Context) *Module

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

func (*ModuleQuery) FirstXID

func (mq *ModuleQuery) FirstXID(ctx context.Context) int

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

func (*ModuleQuery) GroupBy

func (mq *ModuleQuery) GroupBy(field string, fields ...string) *ModuleGroupBy

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

client.Module.Query().
	GroupBy(module.FieldOwner).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ModuleQuery) IDs

func (mq *ModuleQuery) IDs(ctx context.Context) ([]int, error)

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

func (*ModuleQuery) IDsX

func (mq *ModuleQuery) IDsX(ctx context.Context) []int

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

func (*ModuleQuery) Limit

func (mq *ModuleQuery) Limit(limit int) *ModuleQuery

Limit adds a limit step to the query.

func (*ModuleQuery) Offset

func (mq *ModuleQuery) Offset(offset int) *ModuleQuery

Offset adds an offset step to the query.

func (*ModuleQuery) Only

func (mq *ModuleQuery) Only(ctx context.Context) (*Module, error)

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

func (*ModuleQuery) OnlyID

func (mq *ModuleQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*ModuleQuery) OnlyX

func (mq *ModuleQuery) OnlyX(ctx context.Context) *Module

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

func (*ModuleQuery) OnlyXID

func (mq *ModuleQuery) OnlyXID(ctx context.Context) int

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

func (*ModuleQuery) Order

func (mq *ModuleQuery) Order(o ...Order) *ModuleQuery

Order adds an order step to the query.

func (*ModuleQuery) QueryVersion

func (mq *ModuleQuery) QueryVersion() *ModuleVersionQuery

QueryVersion chains the current query on the version edge.

func (*ModuleQuery) Select

func (mq *ModuleQuery) Select(field string, fields ...string) *ModuleSelect

Select one or more fields from the given query.

Example:

var v []struct {
	Owner string `json:"owner,omitempty"`
}

client.Module.Query().
	Select(module.FieldOwner).
	Scan(ctx, &v)

func (*ModuleQuery) Where

func (mq *ModuleQuery) Where(ps ...predicate.Module) *ModuleQuery

Where adds a new predicate for the builder.

type ModuleSelect

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

ModuleSelect is the builder for select fields of Module entities.

func (*ModuleSelect) Bools

func (ms *ModuleSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*ModuleSelect) BoolsX

func (ms *ModuleSelect) BoolsX(ctx context.Context) []bool

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

func (*ModuleSelect) Float64s

func (ms *ModuleSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*ModuleSelect) Float64sX

func (ms *ModuleSelect) Float64sX(ctx context.Context) []float64

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

func (*ModuleSelect) Ints

func (ms *ModuleSelect) Ints(ctx context.Context) ([]int, error)

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

func (*ModuleSelect) IntsX

func (ms *ModuleSelect) IntsX(ctx context.Context) []int

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

func (*ModuleSelect) Scan

func (ms *ModuleSelect) Scan(ctx context.Context, v interface{}) error

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

func (*ModuleSelect) ScanX

func (ms *ModuleSelect) ScanX(ctx context.Context, v interface{})

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

func (*ModuleSelect) Strings

func (ms *ModuleSelect) Strings(ctx context.Context) ([]string, error)

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

func (*ModuleSelect) StringsX

func (ms *ModuleSelect) StringsX(ctx context.Context) []string

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

type ModuleUpdate

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

ModuleUpdate is the builder for updating Module entities.

func (*ModuleUpdate) AddAppID

func (mu *ModuleUpdate) AddAppID(i int64) *ModuleUpdate

AddAppID adds i to app_id.

func (*ModuleUpdate) AddDownloads

func (mu *ModuleUpdate) AddDownloads(i int64) *ModuleUpdate

AddDownloads adds i to downloads.

func (*ModuleUpdate) AddInstallationID

func (mu *ModuleUpdate) AddInstallationID(i int64) *ModuleUpdate

AddInstallationID adds i to installation_id.

func (*ModuleUpdate) AddVersion

func (mu *ModuleUpdate) AddVersion(m ...*ModuleVersion) *ModuleUpdate

AddVersion adds the version edges to ModuleVersion.

func (*ModuleUpdate) AddVersionIDs

func (mu *ModuleUpdate) AddVersionIDs(ids ...int) *ModuleUpdate

AddVersionIDs adds the version edge to ModuleVersion by ids.

func (*ModuleUpdate) Exec

func (mu *ModuleUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*ModuleUpdate) ExecX

func (mu *ModuleUpdate) ExecX(ctx context.Context)

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

func (*ModuleUpdate) RemoveVersion

func (mu *ModuleUpdate) RemoveVersion(m ...*ModuleVersion) *ModuleUpdate

RemoveVersion removes version edges to ModuleVersion.

func (*ModuleUpdate) RemoveVersionIDs

func (mu *ModuleUpdate) RemoveVersionIDs(ids ...int) *ModuleUpdate

RemoveVersionIDs removes the version edge to ModuleVersion by ids.

func (*ModuleUpdate) Save

func (mu *ModuleUpdate) Save(ctx context.Context) (int, error)

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

func (*ModuleUpdate) SaveX

func (mu *ModuleUpdate) SaveX(ctx context.Context) int

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

func (*ModuleUpdate) SetAppID

func (mu *ModuleUpdate) SetAppID(i int64) *ModuleUpdate

SetAppID sets the app_id field.

func (*ModuleUpdate) SetDescription

func (mu *ModuleUpdate) SetDescription(s string) *ModuleUpdate

SetDescription sets the description field.

func (*ModuleUpdate) SetDownloads

func (mu *ModuleUpdate) SetDownloads(i int64) *ModuleUpdate

SetDownloads sets the downloads field.

func (*ModuleUpdate) SetInstallationID

func (mu *ModuleUpdate) SetInstallationID(i int64) *ModuleUpdate

SetInstallationID sets the installation_id field.

func (*ModuleUpdate) SetName

func (mu *ModuleUpdate) SetName(s string) *ModuleUpdate

SetName sets the name field.

func (*ModuleUpdate) SetNamespace

func (mu *ModuleUpdate) SetNamespace(s string) *ModuleUpdate

SetNamespace sets the namespace field.

func (*ModuleUpdate) SetNillableDownloads

func (mu *ModuleUpdate) SetNillableDownloads(i *int64) *ModuleUpdate

SetNillableDownloads sets the downloads field if the given value is not nil.

func (*ModuleUpdate) SetOwner

func (mu *ModuleUpdate) SetOwner(s string) *ModuleUpdate

SetOwner sets the owner field.

func (*ModuleUpdate) SetProvider

func (mu *ModuleUpdate) SetProvider(s string) *ModuleUpdate

SetProvider sets the provider field.

func (*ModuleUpdate) SetPublishedAt

func (mu *ModuleUpdate) SetPublishedAt(t time.Time) *ModuleUpdate

SetPublishedAt sets the published_at field.

func (*ModuleUpdate) SetRepoName

func (mu *ModuleUpdate) SetRepoName(s string) *ModuleUpdate

SetRepoName sets the repo_name field.

func (*ModuleUpdate) SetSource

func (mu *ModuleUpdate) SetSource(s string) *ModuleUpdate

SetSource sets the source field.

func (*ModuleUpdate) Where

func (mu *ModuleUpdate) Where(ps ...predicate.Module) *ModuleUpdate

Where adds a new predicate for the builder.

type ModuleUpdateOne

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

ModuleUpdateOne is the builder for updating a single Module entity.

func (*ModuleUpdateOne) AddAppID

func (muo *ModuleUpdateOne) AddAppID(i int64) *ModuleUpdateOne

AddAppID adds i to app_id.

func (*ModuleUpdateOne) AddDownloads

func (muo *ModuleUpdateOne) AddDownloads(i int64) *ModuleUpdateOne

AddDownloads adds i to downloads.

func (*ModuleUpdateOne) AddInstallationID

func (muo *ModuleUpdateOne) AddInstallationID(i int64) *ModuleUpdateOne

AddInstallationID adds i to installation_id.

func (*ModuleUpdateOne) AddVersion

func (muo *ModuleUpdateOne) AddVersion(m ...*ModuleVersion) *ModuleUpdateOne

AddVersion adds the version edges to ModuleVersion.

func (*ModuleUpdateOne) AddVersionIDs

func (muo *ModuleUpdateOne) AddVersionIDs(ids ...int) *ModuleUpdateOne

AddVersionIDs adds the version edge to ModuleVersion by ids.

func (*ModuleUpdateOne) Exec

func (muo *ModuleUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*ModuleUpdateOne) ExecX

func (muo *ModuleUpdateOne) ExecX(ctx context.Context)

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

func (*ModuleUpdateOne) RemoveVersion

func (muo *ModuleUpdateOne) RemoveVersion(m ...*ModuleVersion) *ModuleUpdateOne

RemoveVersion removes version edges to ModuleVersion.

func (*ModuleUpdateOne) RemoveVersionIDs

func (muo *ModuleUpdateOne) RemoveVersionIDs(ids ...int) *ModuleUpdateOne

RemoveVersionIDs removes the version edge to ModuleVersion by ids.

func (*ModuleUpdateOne) Save

func (muo *ModuleUpdateOne) Save(ctx context.Context) (*Module, error)

Save executes the query and returns the updated entity.

func (*ModuleUpdateOne) SaveX

func (muo *ModuleUpdateOne) SaveX(ctx context.Context) *Module

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

func (*ModuleUpdateOne) SetAppID

func (muo *ModuleUpdateOne) SetAppID(i int64) *ModuleUpdateOne

SetAppID sets the app_id field.

func (*ModuleUpdateOne) SetDescription

func (muo *ModuleUpdateOne) SetDescription(s string) *ModuleUpdateOne

SetDescription sets the description field.

func (*ModuleUpdateOne) SetDownloads

func (muo *ModuleUpdateOne) SetDownloads(i int64) *ModuleUpdateOne

SetDownloads sets the downloads field.

func (*ModuleUpdateOne) SetInstallationID

func (muo *ModuleUpdateOne) SetInstallationID(i int64) *ModuleUpdateOne

SetInstallationID sets the installation_id field.

func (*ModuleUpdateOne) SetName

func (muo *ModuleUpdateOne) SetName(s string) *ModuleUpdateOne

SetName sets the name field.

func (*ModuleUpdateOne) SetNamespace

func (muo *ModuleUpdateOne) SetNamespace(s string) *ModuleUpdateOne

SetNamespace sets the namespace field.

func (*ModuleUpdateOne) SetNillableDownloads

func (muo *ModuleUpdateOne) SetNillableDownloads(i *int64) *ModuleUpdateOne

SetNillableDownloads sets the downloads field if the given value is not nil.

func (*ModuleUpdateOne) SetOwner

func (muo *ModuleUpdateOne) SetOwner(s string) *ModuleUpdateOne

SetOwner sets the owner field.

func (*ModuleUpdateOne) SetProvider

func (muo *ModuleUpdateOne) SetProvider(s string) *ModuleUpdateOne

SetProvider sets the provider field.

func (*ModuleUpdateOne) SetPublishedAt

func (muo *ModuleUpdateOne) SetPublishedAt(t time.Time) *ModuleUpdateOne

SetPublishedAt sets the published_at field.

func (*ModuleUpdateOne) SetRepoName

func (muo *ModuleUpdateOne) SetRepoName(s string) *ModuleUpdateOne

SetRepoName sets the repo_name field.

func (*ModuleUpdateOne) SetSource

func (muo *ModuleUpdateOne) SetSource(s string) *ModuleUpdateOne

SetSource sets the source field.

type ModuleVersion

type ModuleVersion struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Major holds the value of the "major" field.
	Major int `json:"major,omitempty"`
	// Minor holds the value of the "minor" field.
	Minor int `json:"minor,omitempty"`
	// Patch holds the value of the "patch" field.
	Patch int `json:"patch,omitempty"`
	// Tag holds the value of the "tag" field.
	Tag string `json:"tag,omitempty"`
	// contains filtered or unexported fields
}

ModuleVersion is the model entity for the ModuleVersion schema.

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

// create moduleversion vertex with its edges.
mv := client.ModuleVersion.
	Create().
	SetMajor(1).
	SetMinor(1).
	SetPatch(1).
	SetTag("string").
	SaveX(ctx)
log.Println("moduleversion created:", mv)

// query edges.
Output:

func (*ModuleVersion) FromRows

func (mv *ModuleVersion) FromRows(rows *sql.Rows) error

FromRows scans the sql response data into ModuleVersion.

func (*ModuleVersion) QueryModule

func (mv *ModuleVersion) QueryModule() *ModuleQuery

QueryModule queries the module edge of the ModuleVersion.

func (*ModuleVersion) String

func (mv *ModuleVersion) String() string

String implements the fmt.Stringer.

func (*ModuleVersion) Unwrap

func (mv *ModuleVersion) Unwrap() *ModuleVersion

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

func (mv *ModuleVersion) Update() *ModuleVersionUpdateOne

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

type ModuleVersionClient

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

ModuleVersionClient is a client for the ModuleVersion schema.

func NewModuleVersionClient

func NewModuleVersionClient(c config) *ModuleVersionClient

NewModuleVersionClient returns a client for the ModuleVersion from the given config.

func (*ModuleVersionClient) Create

Create returns a create builder for ModuleVersion.

func (*ModuleVersionClient) Delete

Delete returns a delete builder for ModuleVersion.

func (*ModuleVersionClient) DeleteOne

DeleteOne returns a delete builder for the given entity.

func (*ModuleVersionClient) DeleteOneID

func (c *ModuleVersionClient) DeleteOneID(id int) *ModuleVersionDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*ModuleVersionClient) Get

Get returns a ModuleVersion entity by its id.

func (*ModuleVersionClient) GetX

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

func (*ModuleVersionClient) Query

Create returns a query builder for ModuleVersion.

func (*ModuleVersionClient) QueryModule

func (c *ModuleVersionClient) QueryModule(mv *ModuleVersion) *ModuleQuery

QueryModule queries the module edge of a ModuleVersion.

func (*ModuleVersionClient) Update

Update returns an update builder for ModuleVersion.

func (*ModuleVersionClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*ModuleVersionClient) UpdateOneID

func (c *ModuleVersionClient) UpdateOneID(id int) *ModuleVersionUpdateOne

UpdateOneID returns an update builder for the given id.

type ModuleVersionCreate

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

ModuleVersionCreate is the builder for creating a ModuleVersion entity.

func (*ModuleVersionCreate) Save

Save creates the ModuleVersion in the database.

func (*ModuleVersionCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*ModuleVersionCreate) SetMajor

func (mvc *ModuleVersionCreate) SetMajor(i int) *ModuleVersionCreate

SetMajor sets the major field.

func (*ModuleVersionCreate) SetMinor

func (mvc *ModuleVersionCreate) SetMinor(i int) *ModuleVersionCreate

SetMinor sets the minor field.

func (*ModuleVersionCreate) SetModule

func (mvc *ModuleVersionCreate) SetModule(m *Module) *ModuleVersionCreate

SetModule sets the module edge to Module.

func (*ModuleVersionCreate) SetModuleID

func (mvc *ModuleVersionCreate) SetModuleID(id int) *ModuleVersionCreate

SetModuleID sets the module edge to Module by id.

func (*ModuleVersionCreate) SetPatch

func (mvc *ModuleVersionCreate) SetPatch(i int) *ModuleVersionCreate

SetPatch sets the patch field.

func (*ModuleVersionCreate) SetTag

SetTag sets the tag field.

type ModuleVersionDelete

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

ModuleVersionDelete is the builder for deleting a ModuleVersion entity.

func (*ModuleVersionDelete) Exec

func (mvd *ModuleVersionDelete) Exec(ctx context.Context) (int, error)

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

func (*ModuleVersionDelete) ExecX

func (mvd *ModuleVersionDelete) ExecX(ctx context.Context) int

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

func (*ModuleVersionDelete) Where

Where adds a new predicate to the delete builder.

type ModuleVersionDeleteOne

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

ModuleVersionDeleteOne is the builder for deleting a single ModuleVersion entity.

func (*ModuleVersionDeleteOne) Exec

func (mvdo *ModuleVersionDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*ModuleVersionDeleteOne) ExecX

func (mvdo *ModuleVersionDeleteOne) ExecX(ctx context.Context)

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

type ModuleVersionGroupBy

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

ModuleVersionGroupBy is the builder for group-by ModuleVersion entities.

func (*ModuleVersionGroupBy) Aggregate

func (mvgb *ModuleVersionGroupBy) Aggregate(fns ...Aggregate) *ModuleVersionGroupBy

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

func (*ModuleVersionGroupBy) Bools

func (mvgb *ModuleVersionGroupBy) 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 (*ModuleVersionGroupBy) BoolsX

func (mvgb *ModuleVersionGroupBy) BoolsX(ctx context.Context) []bool

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

func (*ModuleVersionGroupBy) Float64s

func (mvgb *ModuleVersionGroupBy) 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 (*ModuleVersionGroupBy) Float64sX

func (mvgb *ModuleVersionGroupBy) Float64sX(ctx context.Context) []float64

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

func (*ModuleVersionGroupBy) Ints

func (mvgb *ModuleVersionGroupBy) 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 (*ModuleVersionGroupBy) IntsX

func (mvgb *ModuleVersionGroupBy) IntsX(ctx context.Context) []int

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

func (*ModuleVersionGroupBy) Scan

func (mvgb *ModuleVersionGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*ModuleVersionGroupBy) ScanX

func (mvgb *ModuleVersionGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*ModuleVersionGroupBy) Strings

func (mvgb *ModuleVersionGroupBy) 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 (*ModuleVersionGroupBy) StringsX

func (mvgb *ModuleVersionGroupBy) StringsX(ctx context.Context) []string

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

type ModuleVersionQuery

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

ModuleVersionQuery is the builder for querying ModuleVersion entities.

func (*ModuleVersionQuery) All

All executes the query and returns a list of ModuleVersions.

func (*ModuleVersionQuery) AllX

func (mvq *ModuleVersionQuery) AllX(ctx context.Context) []*ModuleVersion

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

func (*ModuleVersionQuery) Clone

func (mvq *ModuleVersionQuery) Clone() *ModuleVersionQuery

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

func (mvq *ModuleVersionQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*ModuleVersionQuery) CountX

func (mvq *ModuleVersionQuery) CountX(ctx context.Context) int

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

func (*ModuleVersionQuery) Exist

func (mvq *ModuleVersionQuery) Exist(ctx context.Context) (bool, error)

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

func (*ModuleVersionQuery) ExistX

func (mvq *ModuleVersionQuery) ExistX(ctx context.Context) bool

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

func (*ModuleVersionQuery) First

First returns the first ModuleVersion entity in the query. Returns *ErrNotFound when no moduleversion was found.

func (*ModuleVersionQuery) FirstID

func (mvq *ModuleVersionQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*ModuleVersionQuery) FirstX

func (mvq *ModuleVersionQuery) FirstX(ctx context.Context) *ModuleVersion

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

func (*ModuleVersionQuery) FirstXID

func (mvq *ModuleVersionQuery) FirstXID(ctx context.Context) int

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

func (*ModuleVersionQuery) GroupBy

func (mvq *ModuleVersionQuery) GroupBy(field string, fields ...string) *ModuleVersionGroupBy

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

client.ModuleVersion.Query().
	GroupBy(moduleversion.FieldMajor).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ModuleVersionQuery) IDs

func (mvq *ModuleVersionQuery) IDs(ctx context.Context) ([]int, error)

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

func (*ModuleVersionQuery) IDsX

func (mvq *ModuleVersionQuery) IDsX(ctx context.Context) []int

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

func (*ModuleVersionQuery) Limit

func (mvq *ModuleVersionQuery) Limit(limit int) *ModuleVersionQuery

Limit adds a limit step to the query.

func (*ModuleVersionQuery) Offset

func (mvq *ModuleVersionQuery) Offset(offset int) *ModuleVersionQuery

Offset adds an offset step to the query.

func (*ModuleVersionQuery) Only

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

func (*ModuleVersionQuery) OnlyID

func (mvq *ModuleVersionQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*ModuleVersionQuery) OnlyX

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

func (*ModuleVersionQuery) OnlyXID

func (mvq *ModuleVersionQuery) OnlyXID(ctx context.Context) int

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

func (*ModuleVersionQuery) Order

func (mvq *ModuleVersionQuery) Order(o ...Order) *ModuleVersionQuery

Order adds an order step to the query.

func (*ModuleVersionQuery) QueryModule

func (mvq *ModuleVersionQuery) QueryModule() *ModuleQuery

QueryModule chains the current query on the module edge.

func (*ModuleVersionQuery) Select

func (mvq *ModuleVersionQuery) Select(field string, fields ...string) *ModuleVersionSelect

Select one or more fields from the given query.

Example:

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

client.ModuleVersion.Query().
	Select(moduleversion.FieldMajor).
	Scan(ctx, &v)

func (*ModuleVersionQuery) Where

Where adds a new predicate for the builder.

type ModuleVersionSelect

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

ModuleVersionSelect is the builder for select fields of ModuleVersion entities.

func (*ModuleVersionSelect) Bools

func (mvs *ModuleVersionSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*ModuleVersionSelect) BoolsX

func (mvs *ModuleVersionSelect) BoolsX(ctx context.Context) []bool

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

func (*ModuleVersionSelect) Float64s

func (mvs *ModuleVersionSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*ModuleVersionSelect) Float64sX

func (mvs *ModuleVersionSelect) Float64sX(ctx context.Context) []float64

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

func (*ModuleVersionSelect) Ints

func (mvs *ModuleVersionSelect) Ints(ctx context.Context) ([]int, error)

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

func (*ModuleVersionSelect) IntsX

func (mvs *ModuleVersionSelect) IntsX(ctx context.Context) []int

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

func (*ModuleVersionSelect) Scan

func (mvs *ModuleVersionSelect) Scan(ctx context.Context, v interface{}) error

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

func (*ModuleVersionSelect) ScanX

func (mvs *ModuleVersionSelect) ScanX(ctx context.Context, v interface{})

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

func (*ModuleVersionSelect) Strings

func (mvs *ModuleVersionSelect) Strings(ctx context.Context) ([]string, error)

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

func (*ModuleVersionSelect) StringsX

func (mvs *ModuleVersionSelect) StringsX(ctx context.Context) []string

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

type ModuleVersionUpdate

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

ModuleVersionUpdate is the builder for updating ModuleVersion entities.

func (*ModuleVersionUpdate) AddMajor

func (mvu *ModuleVersionUpdate) AddMajor(i int) *ModuleVersionUpdate

AddMajor adds i to major.

func (*ModuleVersionUpdate) AddMinor

func (mvu *ModuleVersionUpdate) AddMinor(i int) *ModuleVersionUpdate

AddMinor adds i to minor.

func (*ModuleVersionUpdate) AddPatch

func (mvu *ModuleVersionUpdate) AddPatch(i int) *ModuleVersionUpdate

AddPatch adds i to patch.

func (*ModuleVersionUpdate) ClearModule

func (mvu *ModuleVersionUpdate) ClearModule() *ModuleVersionUpdate

ClearModule clears the module edge to Module.

func (*ModuleVersionUpdate) Exec

func (mvu *ModuleVersionUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*ModuleVersionUpdate) ExecX

func (mvu *ModuleVersionUpdate) ExecX(ctx context.Context)

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

func (*ModuleVersionUpdate) Save

func (mvu *ModuleVersionUpdate) Save(ctx context.Context) (int, error)

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

func (*ModuleVersionUpdate) SaveX

func (mvu *ModuleVersionUpdate) SaveX(ctx context.Context) int

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

func (*ModuleVersionUpdate) SetMajor

func (mvu *ModuleVersionUpdate) SetMajor(i int) *ModuleVersionUpdate

SetMajor sets the major field.

func (*ModuleVersionUpdate) SetMinor

func (mvu *ModuleVersionUpdate) SetMinor(i int) *ModuleVersionUpdate

SetMinor sets the minor field.

func (*ModuleVersionUpdate) SetModule

func (mvu *ModuleVersionUpdate) SetModule(m *Module) *ModuleVersionUpdate

SetModule sets the module edge to Module.

func (*ModuleVersionUpdate) SetModuleID

func (mvu *ModuleVersionUpdate) SetModuleID(id int) *ModuleVersionUpdate

SetModuleID sets the module edge to Module by id.

func (*ModuleVersionUpdate) SetPatch

func (mvu *ModuleVersionUpdate) SetPatch(i int) *ModuleVersionUpdate

SetPatch sets the patch field.

func (*ModuleVersionUpdate) SetTag

SetTag sets the tag field.

func (*ModuleVersionUpdate) Where

Where adds a new predicate for the builder.

type ModuleVersionUpdateOne

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

ModuleVersionUpdateOne is the builder for updating a single ModuleVersion entity.

func (*ModuleVersionUpdateOne) AddMajor

AddMajor adds i to major.

func (*ModuleVersionUpdateOne) AddMinor

AddMinor adds i to minor.

func (*ModuleVersionUpdateOne) AddPatch

AddPatch adds i to patch.

func (*ModuleVersionUpdateOne) ClearModule

func (mvuo *ModuleVersionUpdateOne) ClearModule() *ModuleVersionUpdateOne

ClearModule clears the module edge to Module.

func (*ModuleVersionUpdateOne) Exec

func (mvuo *ModuleVersionUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*ModuleVersionUpdateOne) ExecX

func (mvuo *ModuleVersionUpdateOne) ExecX(ctx context.Context)

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

func (*ModuleVersionUpdateOne) Save

Save executes the query and returns the updated entity.

func (*ModuleVersionUpdateOne) SaveX

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

func (*ModuleVersionUpdateOne) SetMajor

SetMajor sets the major field.

func (*ModuleVersionUpdateOne) SetMinor

SetMinor sets the minor field.

func (*ModuleVersionUpdateOne) SetModule

SetModule sets the module edge to Module.

func (*ModuleVersionUpdateOne) SetModuleID

func (mvuo *ModuleVersionUpdateOne) SetModuleID(id int) *ModuleVersionUpdateOne

SetModuleID sets the module edge to Module by id.

func (*ModuleVersionUpdateOne) SetPatch

SetPatch sets the patch field.

func (*ModuleVersionUpdateOne) SetTag

SetTag sets the tag field.

type ModuleVersions

type ModuleVersions []*ModuleVersion

ModuleVersions is a parsable slice of ModuleVersion.

func (*ModuleVersions) FromRows

func (mv *ModuleVersions) FromRows(rows *sql.Rows) error

FromRows scans the sql response data into ModuleVersions.

type Modules

type Modules []*Module

Modules is a parsable slice of Module.

func (*Modules) FromRows

func (m *Modules) FromRows(rows *sql.Rows) error

FromRows scans the sql response data into Modules.

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

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

Log sets the logging function for debug mode.

type Order

type Order func(*sql.Selector)

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

func Asc

func Asc(fields ...string) Order

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) Order

Desc applies the given fields in DESC order.

type Tx

type Tx struct {

	// Module is the client for interacting with the Module builders.
	Module *ModuleClient
	// ModuleVersion is the client for interacting with the ModuleVersion builders.
	ModuleVersion *ModuleVersionClient
	// contains filtered or unexported fields
}

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

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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