ent

package
v0.0.1-beta6 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2022 License: Apache-2.0 Imports: 18 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.
	TypeChaincode = "Chaincode"
	TypeTenant    = "Tenant"
)

Variables

This section is empty.

Functions

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

IsValidationError returns a boolean indicating whether the error is a validation 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 Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) 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 Chaincode

type Chaincode struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// PackageId holds the value of the "packageId" field.
	PackageId string `json:"packageId,omitempty"`
	// ChannelId holds the value of the "channelId" field.
	ChannelId string `json:"channelId,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the ChaincodeQuery when eager-loading is set.
	Edges ChaincodeEdges `json:"edges"`
	// contains filtered or unexported fields
}

Chaincode is the model entity for the Chaincode schema.

func (*Chaincode) QueryTenant

func (c *Chaincode) QueryTenant() *TenantQuery

QueryTenant queries the "tenant" edge of the Chaincode entity.

func (*Chaincode) String

func (c *Chaincode) String() string

String implements the fmt.Stringer.

func (*Chaincode) Unwrap

func (c *Chaincode) Unwrap() *Chaincode

Unwrap unwraps the Chaincode entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*Chaincode) Update

func (c *Chaincode) Update() *ChaincodeUpdateOne

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

type ChaincodeClient

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

ChaincodeClient is a client for the Chaincode schema.

func NewChaincodeClient

func NewChaincodeClient(c config) *ChaincodeClient

NewChaincodeClient returns a client for the Chaincode from the given config.

func (*ChaincodeClient) Create

func (c *ChaincodeClient) Create() *ChaincodeCreate

Create returns a create builder for Chaincode.

func (*ChaincodeClient) CreateBulk

func (c *ChaincodeClient) CreateBulk(builders ...*ChaincodeCreate) *ChaincodeCreateBulk

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

func (*ChaincodeClient) Delete

func (c *ChaincodeClient) Delete() *ChaincodeDelete

Delete returns a delete builder for Chaincode.

func (*ChaincodeClient) DeleteOne

func (c *ChaincodeClient) DeleteOne(ch *Chaincode) *ChaincodeDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*ChaincodeClient) DeleteOneID

func (c *ChaincodeClient) DeleteOneID(id int) *ChaincodeDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*ChaincodeClient) Get

func (c *ChaincodeClient) Get(ctx context.Context, id int) (*Chaincode, error)

Get returns a Chaincode entity by its id.

func (*ChaincodeClient) GetX

func (c *ChaincodeClient) GetX(ctx context.Context, id int) *Chaincode

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

func (*ChaincodeClient) Hooks

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

Hooks returns the client hooks.

func (*ChaincodeClient) Query

func (c *ChaincodeClient) Query() *ChaincodeQuery

Query returns a query builder for Chaincode.

func (*ChaincodeClient) QueryTenant

func (c *ChaincodeClient) QueryTenant(ch *Chaincode) *TenantQuery

QueryTenant queries the tenant edge of a Chaincode.

func (*ChaincodeClient) Update

func (c *ChaincodeClient) Update() *ChaincodeUpdate

Update returns an update builder for Chaincode.

func (*ChaincodeClient) UpdateOne

func (c *ChaincodeClient) UpdateOne(ch *Chaincode) *ChaincodeUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ChaincodeClient) UpdateOneID

func (c *ChaincodeClient) UpdateOneID(id int) *ChaincodeUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ChaincodeClient) Use

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

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

type ChaincodeCreate

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

ChaincodeCreate is the builder for creating a Chaincode entity.

func (*ChaincodeCreate) Exec

func (cc *ChaincodeCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*ChaincodeCreate) ExecX

func (cc *ChaincodeCreate) ExecX(ctx context.Context)

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

func (*ChaincodeCreate) Mutation

func (cc *ChaincodeCreate) Mutation() *ChaincodeMutation

Mutation returns the ChaincodeMutation object of the builder.

func (*ChaincodeCreate) Save

func (cc *ChaincodeCreate) Save(ctx context.Context) (*Chaincode, error)

Save creates the Chaincode in the database.

func (*ChaincodeCreate) SaveX

func (cc *ChaincodeCreate) SaveX(ctx context.Context) *Chaincode

SaveX calls Save and panics if Save returns an error.

func (*ChaincodeCreate) SetChannelId

func (cc *ChaincodeCreate) SetChannelId(s string) *ChaincodeCreate

SetChannelId sets the "channelId" field.

func (*ChaincodeCreate) SetNillableTenantID

func (cc *ChaincodeCreate) SetNillableTenantID(id *int) *ChaincodeCreate

SetNillableTenantID sets the "tenant" edge to the Tenant entity by ID if the given value is not nil.

func (*ChaincodeCreate) SetPackageId

func (cc *ChaincodeCreate) SetPackageId(s string) *ChaincodeCreate

SetPackageId sets the "packageId" field.

func (*ChaincodeCreate) SetTenant

func (cc *ChaincodeCreate) SetTenant(t *Tenant) *ChaincodeCreate

SetTenant sets the "tenant" edge to the Tenant entity.

func (*ChaincodeCreate) SetTenantID

func (cc *ChaincodeCreate) SetTenantID(id int) *ChaincodeCreate

SetTenantID sets the "tenant" edge to the Tenant entity by ID.

type ChaincodeCreateBulk

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

ChaincodeCreateBulk is the builder for creating many Chaincode entities in bulk.

func (*ChaincodeCreateBulk) Exec

func (ccb *ChaincodeCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*ChaincodeCreateBulk) ExecX

func (ccb *ChaincodeCreateBulk) ExecX(ctx context.Context)

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

func (*ChaincodeCreateBulk) Save

func (ccb *ChaincodeCreateBulk) Save(ctx context.Context) ([]*Chaincode, error)

Save creates the Chaincode entities in the database.

func (*ChaincodeCreateBulk) SaveX

func (ccb *ChaincodeCreateBulk) SaveX(ctx context.Context) []*Chaincode

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

type ChaincodeDelete

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

ChaincodeDelete is the builder for deleting a Chaincode entity.

func (*ChaincodeDelete) Exec

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

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

func (*ChaincodeDelete) ExecX

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

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

func (*ChaincodeDelete) Where

Where appends a list predicates to the ChaincodeDelete builder.

type ChaincodeDeleteOne

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

ChaincodeDeleteOne is the builder for deleting a single Chaincode entity.

func (*ChaincodeDeleteOne) Exec

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

Exec executes the deletion query.

func (*ChaincodeDeleteOne) ExecX

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

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

type ChaincodeEdges

type ChaincodeEdges struct {
	// Tenant holds the value of the tenant edge.
	Tenant *Tenant `json:"tenant,omitempty"`
	// contains filtered or unexported fields
}

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

func (ChaincodeEdges) TenantOrErr

func (e ChaincodeEdges) TenantOrErr() (*Tenant, error)

TenantOrErr returns the Tenant value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

type ChaincodeGroupBy

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

ChaincodeGroupBy is the group-by builder for Chaincode entities.

func (*ChaincodeGroupBy) Aggregate

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

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

func (*ChaincodeGroupBy) Bool

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

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

func (*ChaincodeGroupBy) BoolX

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

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

func (*ChaincodeGroupBy) Bools

func (cgb *ChaincodeGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*ChaincodeGroupBy) BoolsX

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

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

func (*ChaincodeGroupBy) Float64

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

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

func (*ChaincodeGroupBy) Float64X

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

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

func (*ChaincodeGroupBy) Float64s

func (cgb *ChaincodeGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*ChaincodeGroupBy) Float64sX

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

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

func (*ChaincodeGroupBy) Int

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

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

func (*ChaincodeGroupBy) IntX

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

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

func (*ChaincodeGroupBy) Ints

func (cgb *ChaincodeGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*ChaincodeGroupBy) IntsX

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

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

func (*ChaincodeGroupBy) Scan

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

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

func (*ChaincodeGroupBy) ScanX

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

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

func (*ChaincodeGroupBy) String

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

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

func (*ChaincodeGroupBy) StringX

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

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

func (*ChaincodeGroupBy) Strings

func (cgb *ChaincodeGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*ChaincodeGroupBy) StringsX

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

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

type ChaincodeMutation

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

ChaincodeMutation represents an operation that mutates the Chaincode nodes in the graph.

func (*ChaincodeMutation) AddField

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

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

func (*ChaincodeMutation) AddedEdges

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

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

func (*ChaincodeMutation) AddedField

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

AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*ChaincodeMutation) AddedFields

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

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

func (*ChaincodeMutation) AddedIDs

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

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*ChaincodeMutation) ChannelId

func (m *ChaincodeMutation) ChannelId() (r string, exists bool)

ChannelId returns the value of the "channelId" field in the mutation.

func (*ChaincodeMutation) ClearEdge

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

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

func (*ChaincodeMutation) ClearField

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

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

func (*ChaincodeMutation) ClearTenant

func (m *ChaincodeMutation) ClearTenant()

ClearTenant clears the "tenant" edge to the Tenant entity.

func (*ChaincodeMutation) ClearedEdges

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

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

func (*ChaincodeMutation) ClearedFields

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

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

func (ChaincodeMutation) Client

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

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

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*ChaincodeMutation) Field

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

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

func (*ChaincodeMutation) FieldCleared

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

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*ChaincodeMutation) Fields

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

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

func (*ChaincodeMutation) ID

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

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*ChaincodeMutation) OldChannelId

func (m *ChaincodeMutation) OldChannelId(ctx context.Context) (v string, err error)

OldChannelId returns the old "channelId" field's value of the Chaincode entity. If the Chaincode 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 the database query fails.

func (*ChaincodeMutation) OldField

func (m *ChaincodeMutation) 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 failed.

func (*ChaincodeMutation) OldPackageId

func (m *ChaincodeMutation) OldPackageId(ctx context.Context) (v string, err error)

OldPackageId returns the old "packageId" field's value of the Chaincode entity. If the Chaincode 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 the database query fails.

func (*ChaincodeMutation) Op

func (m *ChaincodeMutation) Op() Op

Op returns the operation name.

func (*ChaincodeMutation) PackageId

func (m *ChaincodeMutation) PackageId() (r string, exists bool)

PackageId returns the value of the "packageId" field in the mutation.

func (*ChaincodeMutation) RemovedEdges

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

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

func (*ChaincodeMutation) RemovedIDs

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

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*ChaincodeMutation) ResetChannelId

func (m *ChaincodeMutation) ResetChannelId()

ResetChannelId resets all changes to the "channelId" field.

func (*ChaincodeMutation) ResetEdge

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

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

func (*ChaincodeMutation) ResetField

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

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

func (*ChaincodeMutation) ResetPackageId

func (m *ChaincodeMutation) ResetPackageId()

ResetPackageId resets all changes to the "packageId" field.

func (*ChaincodeMutation) ResetTenant

func (m *ChaincodeMutation) ResetTenant()

ResetTenant resets all changes to the "tenant" edge.

func (*ChaincodeMutation) SetChannelId

func (m *ChaincodeMutation) SetChannelId(s string)

SetChannelId sets the "channelId" field.

func (*ChaincodeMutation) SetField

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

SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*ChaincodeMutation) SetPackageId

func (m *ChaincodeMutation) SetPackageId(s string)

SetPackageId sets the "packageId" field.

func (*ChaincodeMutation) SetTenantID

func (m *ChaincodeMutation) SetTenantID(id int)

SetTenantID sets the "tenant" edge to the Tenant entity by id.

func (*ChaincodeMutation) TenantCleared

func (m *ChaincodeMutation) TenantCleared() bool

TenantCleared reports if the "tenant" edge to the Tenant entity was cleared.

func (*ChaincodeMutation) TenantID

func (m *ChaincodeMutation) TenantID() (id int, exists bool)

TenantID returns the "tenant" edge ID in the mutation.

func (*ChaincodeMutation) TenantIDs

func (m *ChaincodeMutation) TenantIDs() (ids []int)

TenantIDs returns the "tenant" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use TenantID instead. It exists only for internal usage by the builders.

func (ChaincodeMutation) Tx

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

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

func (*ChaincodeMutation) Type

func (m *ChaincodeMutation) Type() string

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

func (*ChaincodeMutation) Where

func (m *ChaincodeMutation) Where(ps ...predicate.Chaincode)

Where appends a list predicates to the ChaincodeMutation builder.

type ChaincodeQuery

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

ChaincodeQuery is the builder for querying Chaincode entities.

func (*ChaincodeQuery) All

func (cq *ChaincodeQuery) All(ctx context.Context) ([]*Chaincode, error)

All executes the query and returns a list of Chaincodes.

func (*ChaincodeQuery) AllX

func (cq *ChaincodeQuery) AllX(ctx context.Context) []*Chaincode

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

func (*ChaincodeQuery) Clone

func (cq *ChaincodeQuery) Clone() *ChaincodeQuery

Clone returns a duplicate of the ChaincodeQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*ChaincodeQuery) Count

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

Count returns the count of the given query.

func (*ChaincodeQuery) CountX

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

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

func (*ChaincodeQuery) Exist

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

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

func (*ChaincodeQuery) ExistX

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

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

func (*ChaincodeQuery) First

func (cq *ChaincodeQuery) First(ctx context.Context) (*Chaincode, error)

First returns the first Chaincode entity from the query. Returns a *NotFoundError when no Chaincode was found.

func (*ChaincodeQuery) FirstID

func (cq *ChaincodeQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first Chaincode ID from the query. Returns a *NotFoundError when no Chaincode ID was found.

func (*ChaincodeQuery) FirstIDX

func (cq *ChaincodeQuery) FirstIDX(ctx context.Context) int

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

func (*ChaincodeQuery) FirstX

func (cq *ChaincodeQuery) FirstX(ctx context.Context) *Chaincode

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

func (*ChaincodeQuery) GroupBy

func (cq *ChaincodeQuery) GroupBy(field string, fields ...string) *ChaincodeGroupBy

GroupBy is 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 {
	PackageId string `json:"packageId,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Chaincode.Query().
	GroupBy(chaincode.FieldPackageId).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ChaincodeQuery) IDs

func (cq *ChaincodeQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of Chaincode IDs.

func (*ChaincodeQuery) IDsX

func (cq *ChaincodeQuery) IDsX(ctx context.Context) []int

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

func (*ChaincodeQuery) Limit

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

Limit adds a limit step to the query.

func (*ChaincodeQuery) Offset

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

Offset adds an offset step to the query.

func (*ChaincodeQuery) Only

func (cq *ChaincodeQuery) Only(ctx context.Context) (*Chaincode, error)

Only returns a single Chaincode entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one Chaincode entity is not found. Returns a *NotFoundError when no Chaincode entities are found.

func (*ChaincodeQuery) OnlyID

func (cq *ChaincodeQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only Chaincode ID in the query. Returns a *NotSingularError when exactly one Chaincode ID is not found. Returns a *NotFoundError when no entities are found.

func (*ChaincodeQuery) OnlyIDX

func (cq *ChaincodeQuery) OnlyIDX(ctx context.Context) int

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

func (*ChaincodeQuery) OnlyX

func (cq *ChaincodeQuery) OnlyX(ctx context.Context) *Chaincode

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

func (*ChaincodeQuery) Order

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

Order adds an order step to the query.

func (*ChaincodeQuery) QueryTenant

func (cq *ChaincodeQuery) QueryTenant() *TenantQuery

QueryTenant chains the current query on the "tenant" edge.

func (*ChaincodeQuery) Select

func (cq *ChaincodeQuery) Select(fields ...string) *ChaincodeSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	PackageId string `json:"packageId,omitempty"`
}

client.Chaincode.Query().
	Select(chaincode.FieldPackageId).
	Scan(ctx, &v)

func (*ChaincodeQuery) Unique

func (cq *ChaincodeQuery) Unique(unique bool) *ChaincodeQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*ChaincodeQuery) Where

Where adds a new predicate for the ChaincodeQuery builder.

func (*ChaincodeQuery) WithTenant

func (cq *ChaincodeQuery) WithTenant(opts ...func(*TenantQuery)) *ChaincodeQuery

WithTenant tells the query-builder to eager-load the nodes that are connected to the "tenant" edge. The optional arguments are used to configure the query builder of the edge.

type ChaincodeSelect

type ChaincodeSelect struct {
	*ChaincodeQuery
	// contains filtered or unexported fields
}

ChaincodeSelect is the builder for selecting fields of Chaincode entities.

func (*ChaincodeSelect) Bool

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

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

func (*ChaincodeSelect) BoolX

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

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

func (*ChaincodeSelect) Bools

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

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

func (*ChaincodeSelect) BoolsX

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

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

func (*ChaincodeSelect) Float64

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

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

func (*ChaincodeSelect) Float64X

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

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

func (*ChaincodeSelect) Float64s

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

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

func (*ChaincodeSelect) Float64sX

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

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

func (*ChaincodeSelect) Int

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

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

func (*ChaincodeSelect) IntX

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

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

func (*ChaincodeSelect) Ints

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

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

func (*ChaincodeSelect) IntsX

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

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

func (*ChaincodeSelect) Scan

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

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

func (*ChaincodeSelect) ScanX

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

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

func (*ChaincodeSelect) String

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

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

func (*ChaincodeSelect) StringX

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

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

func (*ChaincodeSelect) Strings

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

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

func (*ChaincodeSelect) StringsX

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

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

type ChaincodeUpdate

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

ChaincodeUpdate is the builder for updating Chaincode entities.

func (*ChaincodeUpdate) ClearTenant

func (cu *ChaincodeUpdate) ClearTenant() *ChaincodeUpdate

ClearTenant clears the "tenant" edge to the Tenant entity.

func (*ChaincodeUpdate) Exec

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

Exec executes the query.

func (*ChaincodeUpdate) ExecX

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

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

func (*ChaincodeUpdate) Mutation

func (cu *ChaincodeUpdate) Mutation() *ChaincodeMutation

Mutation returns the ChaincodeMutation object of the builder.

func (*ChaincodeUpdate) Save

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

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

func (*ChaincodeUpdate) SaveX

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

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

func (*ChaincodeUpdate) SetChannelId

func (cu *ChaincodeUpdate) SetChannelId(s string) *ChaincodeUpdate

SetChannelId sets the "channelId" field.

func (*ChaincodeUpdate) SetNillableTenantID

func (cu *ChaincodeUpdate) SetNillableTenantID(id *int) *ChaincodeUpdate

SetNillableTenantID sets the "tenant" edge to the Tenant entity by ID if the given value is not nil.

func (*ChaincodeUpdate) SetPackageId

func (cu *ChaincodeUpdate) SetPackageId(s string) *ChaincodeUpdate

SetPackageId sets the "packageId" field.

func (*ChaincodeUpdate) SetTenant

func (cu *ChaincodeUpdate) SetTenant(t *Tenant) *ChaincodeUpdate

SetTenant sets the "tenant" edge to the Tenant entity.

func (*ChaincodeUpdate) SetTenantID

func (cu *ChaincodeUpdate) SetTenantID(id int) *ChaincodeUpdate

SetTenantID sets the "tenant" edge to the Tenant entity by ID.

func (*ChaincodeUpdate) Where

Where appends a list predicates to the ChaincodeUpdate builder.

type ChaincodeUpdateOne

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

ChaincodeUpdateOne is the builder for updating a single Chaincode entity.

func (*ChaincodeUpdateOne) ClearTenant

func (cuo *ChaincodeUpdateOne) ClearTenant() *ChaincodeUpdateOne

ClearTenant clears the "tenant" edge to the Tenant entity.

func (*ChaincodeUpdateOne) Exec

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

Exec executes the query on the entity.

func (*ChaincodeUpdateOne) ExecX

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

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

func (*ChaincodeUpdateOne) Mutation

func (cuo *ChaincodeUpdateOne) Mutation() *ChaincodeMutation

Mutation returns the ChaincodeMutation object of the builder.

func (*ChaincodeUpdateOne) Save

func (cuo *ChaincodeUpdateOne) Save(ctx context.Context) (*Chaincode, error)

Save executes the query and returns the updated Chaincode entity.

func (*ChaincodeUpdateOne) SaveX

func (cuo *ChaincodeUpdateOne) SaveX(ctx context.Context) *Chaincode

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

func (*ChaincodeUpdateOne) Select

func (cuo *ChaincodeUpdateOne) Select(field string, fields ...string) *ChaincodeUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*ChaincodeUpdateOne) SetChannelId

func (cuo *ChaincodeUpdateOne) SetChannelId(s string) *ChaincodeUpdateOne

SetChannelId sets the "channelId" field.

func (*ChaincodeUpdateOne) SetNillableTenantID

func (cuo *ChaincodeUpdateOne) SetNillableTenantID(id *int) *ChaincodeUpdateOne

SetNillableTenantID sets the "tenant" edge to the Tenant entity by ID if the given value is not nil.

func (*ChaincodeUpdateOne) SetPackageId

func (cuo *ChaincodeUpdateOne) SetPackageId(s string) *ChaincodeUpdateOne

SetPackageId sets the "packageId" field.

func (*ChaincodeUpdateOne) SetTenant

func (cuo *ChaincodeUpdateOne) SetTenant(t *Tenant) *ChaincodeUpdateOne

SetTenant sets the "tenant" edge to the Tenant entity.

func (*ChaincodeUpdateOne) SetTenantID

func (cuo *ChaincodeUpdateOne) SetTenantID(id int) *ChaincodeUpdateOne

SetTenantID sets the "tenant" edge to the Tenant entity by ID.

type Chaincodes

type Chaincodes []*Chaincode

Chaincodes is a parsable slice of Chaincode.

type Client

type Client struct {

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

Client is the client that holds all ent builders.

func FromContext

func FromContext(ctx context.Context) *Client

FromContext returns a Client stored inside 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 specified 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().
	Chaincode.
	Query().
	Count(ctx)

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 Hook

type Hook = ent.Hook

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

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

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

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

ent aliases to avoid import conflicts 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 OrderFunc

type OrderFunc func(*sql.Selector)

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 Policy

type Policy = ent.Policy

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

type Query

type Query = ent.Query

ent aliases to avoid import conflicts 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 Tenant

type Tenant struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// MspId holds the value of the "mspId" field.
	MspId string `json:"mspId,omitempty"`
	// SignCertCAPrivateKey holds the value of the "signCertCAPrivateKey" field.
	SignCertCAPrivateKey []byte `json:"signCertCAPrivateKey,omitempty"`
	// SignCertCACert holds the value of the "signCertCACert" field.
	SignCertCACert []byte `json:"signCertCACert,omitempty"`
	// TlsCertCAPrivateKey holds the value of the "tlsCertCAPrivateKey" field.
	TlsCertCAPrivateKey []byte `json:"tlsCertCAPrivateKey,omitempty"`
	// TlsCertCACert holds the value of the "tlsCertCACert" field.
	TlsCertCACert []byte `json:"tlsCertCACert,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the TenantQuery when eager-loading is set.
	Edges TenantEdges `json:"edges"`
	// contains filtered or unexported fields
}

Tenant is the model entity for the Tenant schema.

func (*Tenant) QueryChaincodes

func (t *Tenant) QueryChaincodes() *ChaincodeQuery

QueryChaincodes queries the "chaincodes" edge of the Tenant entity.

func (*Tenant) String

func (t *Tenant) String() string

String implements the fmt.Stringer.

func (*Tenant) Unwrap

func (t *Tenant) Unwrap() *Tenant

Unwrap unwraps the Tenant entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*Tenant) Update

func (t *Tenant) Update() *TenantUpdateOne

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

type TenantClient

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

TenantClient is a client for the Tenant schema.

func NewTenantClient

func NewTenantClient(c config) *TenantClient

NewTenantClient returns a client for the Tenant from the given config.

func (*TenantClient) Create

func (c *TenantClient) Create() *TenantCreate

Create returns a create builder for Tenant.

func (*TenantClient) CreateBulk

func (c *TenantClient) CreateBulk(builders ...*TenantCreate) *TenantCreateBulk

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

func (*TenantClient) Delete

func (c *TenantClient) Delete() *TenantDelete

Delete returns a delete builder for Tenant.

func (*TenantClient) DeleteOne

func (c *TenantClient) DeleteOne(t *Tenant) *TenantDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*TenantClient) DeleteOneID

func (c *TenantClient) DeleteOneID(id int) *TenantDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*TenantClient) Get

func (c *TenantClient) Get(ctx context.Context, id int) (*Tenant, error)

Get returns a Tenant entity by its id.

func (*TenantClient) GetX

func (c *TenantClient) GetX(ctx context.Context, id int) *Tenant

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

func (*TenantClient) Hooks

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

Hooks returns the client hooks.

func (*TenantClient) Query

func (c *TenantClient) Query() *TenantQuery

Query returns a query builder for Tenant.

func (*TenantClient) QueryChaincodes

func (c *TenantClient) QueryChaincodes(t *Tenant) *ChaincodeQuery

QueryChaincodes queries the chaincodes edge of a Tenant.

func (*TenantClient) Update

func (c *TenantClient) Update() *TenantUpdate

Update returns an update builder for Tenant.

func (*TenantClient) UpdateOne

func (c *TenantClient) UpdateOne(t *Tenant) *TenantUpdateOne

UpdateOne returns an update builder for the given entity.

func (*TenantClient) UpdateOneID

func (c *TenantClient) UpdateOneID(id int) *TenantUpdateOne

UpdateOneID returns an update builder for the given id.

func (*TenantClient) Use

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

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

type TenantCreate

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

TenantCreate is the builder for creating a Tenant entity.

func (*TenantCreate) AddChaincodeIDs

func (tc *TenantCreate) AddChaincodeIDs(ids ...int) *TenantCreate

AddChaincodeIDs adds the "chaincodes" edge to the Chaincode entity by IDs.

func (*TenantCreate) AddChaincodes

func (tc *TenantCreate) AddChaincodes(c ...*Chaincode) *TenantCreate

AddChaincodes adds the "chaincodes" edges to the Chaincode entity.

func (*TenantCreate) Exec

func (tc *TenantCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*TenantCreate) ExecX

func (tc *TenantCreate) ExecX(ctx context.Context)

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

func (*TenantCreate) Mutation

func (tc *TenantCreate) Mutation() *TenantMutation

Mutation returns the TenantMutation object of the builder.

func (*TenantCreate) Save

func (tc *TenantCreate) Save(ctx context.Context) (*Tenant, error)

Save creates the Tenant in the database.

func (*TenantCreate) SaveX

func (tc *TenantCreate) SaveX(ctx context.Context) *Tenant

SaveX calls Save and panics if Save returns an error.

func (*TenantCreate) SetMspId

func (tc *TenantCreate) SetMspId(s string) *TenantCreate

SetMspId sets the "mspId" field.

func (*TenantCreate) SetName

func (tc *TenantCreate) SetName(s string) *TenantCreate

SetName sets the "name" field.

func (*TenantCreate) SetSignCertCACert

func (tc *TenantCreate) SetSignCertCACert(b []byte) *TenantCreate

SetSignCertCACert sets the "signCertCACert" field.

func (*TenantCreate) SetSignCertCAPrivateKey

func (tc *TenantCreate) SetSignCertCAPrivateKey(b []byte) *TenantCreate

SetSignCertCAPrivateKey sets the "signCertCAPrivateKey" field.

func (*TenantCreate) SetTlsCertCACert

func (tc *TenantCreate) SetTlsCertCACert(b []byte) *TenantCreate

SetTlsCertCACert sets the "tlsCertCACert" field.

func (*TenantCreate) SetTlsCertCAPrivateKey

func (tc *TenantCreate) SetTlsCertCAPrivateKey(b []byte) *TenantCreate

SetTlsCertCAPrivateKey sets the "tlsCertCAPrivateKey" field.

type TenantCreateBulk

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

TenantCreateBulk is the builder for creating many Tenant entities in bulk.

func (*TenantCreateBulk) Exec

func (tcb *TenantCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*TenantCreateBulk) ExecX

func (tcb *TenantCreateBulk) ExecX(ctx context.Context)

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

func (*TenantCreateBulk) Save

func (tcb *TenantCreateBulk) Save(ctx context.Context) ([]*Tenant, error)

Save creates the Tenant entities in the database.

func (*TenantCreateBulk) SaveX

func (tcb *TenantCreateBulk) SaveX(ctx context.Context) []*Tenant

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

type TenantDelete

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

TenantDelete is the builder for deleting a Tenant entity.

func (*TenantDelete) Exec

func (td *TenantDelete) Exec(ctx context.Context) (int, error)

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

func (*TenantDelete) ExecX

func (td *TenantDelete) ExecX(ctx context.Context) int

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

func (*TenantDelete) Where

func (td *TenantDelete) Where(ps ...predicate.Tenant) *TenantDelete

Where appends a list predicates to the TenantDelete builder.

type TenantDeleteOne

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

TenantDeleteOne is the builder for deleting a single Tenant entity.

func (*TenantDeleteOne) Exec

func (tdo *TenantDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*TenantDeleteOne) ExecX

func (tdo *TenantDeleteOne) ExecX(ctx context.Context)

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

type TenantEdges

type TenantEdges struct {
	// Chaincodes holds the value of the chaincodes edge.
	Chaincodes []*Chaincode `json:"chaincodes,omitempty"`
	// contains filtered or unexported fields
}

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

func (TenantEdges) ChaincodesOrErr

func (e TenantEdges) ChaincodesOrErr() ([]*Chaincode, error)

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

type TenantGroupBy

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

TenantGroupBy is the group-by builder for Tenant entities.

func (*TenantGroupBy) Aggregate

func (tgb *TenantGroupBy) Aggregate(fns ...AggregateFunc) *TenantGroupBy

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

func (*TenantGroupBy) Bool

func (tgb *TenantGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*TenantGroupBy) BoolX

func (tgb *TenantGroupBy) BoolX(ctx context.Context) bool

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

func (*TenantGroupBy) Bools

func (tgb *TenantGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*TenantGroupBy) BoolsX

func (tgb *TenantGroupBy) BoolsX(ctx context.Context) []bool

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

func (*TenantGroupBy) Float64

func (tgb *TenantGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*TenantGroupBy) Float64X

func (tgb *TenantGroupBy) Float64X(ctx context.Context) float64

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

func (*TenantGroupBy) Float64s

func (tgb *TenantGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*TenantGroupBy) Float64sX

func (tgb *TenantGroupBy) Float64sX(ctx context.Context) []float64

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

func (*TenantGroupBy) Int

func (tgb *TenantGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*TenantGroupBy) IntX

func (tgb *TenantGroupBy) IntX(ctx context.Context) int

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

func (*TenantGroupBy) Ints

func (tgb *TenantGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*TenantGroupBy) IntsX

func (tgb *TenantGroupBy) IntsX(ctx context.Context) []int

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

func (*TenantGroupBy) Scan

func (tgb *TenantGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*TenantGroupBy) ScanX

func (tgb *TenantGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*TenantGroupBy) String

func (tgb *TenantGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*TenantGroupBy) StringX

func (tgb *TenantGroupBy) StringX(ctx context.Context) string

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

func (*TenantGroupBy) Strings

func (tgb *TenantGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*TenantGroupBy) StringsX

func (tgb *TenantGroupBy) StringsX(ctx context.Context) []string

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

type TenantMutation

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

TenantMutation represents an operation that mutates the Tenant nodes in the graph.

func (*TenantMutation) AddChaincodeIDs

func (m *TenantMutation) AddChaincodeIDs(ids ...int)

AddChaincodeIDs adds the "chaincodes" edge to the Chaincode entity by ids.

func (*TenantMutation) AddField

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

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

func (*TenantMutation) AddedEdges

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

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

func (*TenantMutation) AddedField

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

AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*TenantMutation) AddedFields

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

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

func (*TenantMutation) AddedIDs

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

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*TenantMutation) ChaincodesCleared

func (m *TenantMutation) ChaincodesCleared() bool

ChaincodesCleared reports if the "chaincodes" edge to the Chaincode entity was cleared.

func (*TenantMutation) ChaincodesIDs

func (m *TenantMutation) ChaincodesIDs() (ids []int)

ChaincodesIDs returns the "chaincodes" edge IDs in the mutation.

func (*TenantMutation) ClearChaincodes

func (m *TenantMutation) ClearChaincodes()

ClearChaincodes clears the "chaincodes" edge to the Chaincode entity.

func (*TenantMutation) ClearEdge

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

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

func (*TenantMutation) ClearField

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

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

func (*TenantMutation) ClearSignCertCACert

func (m *TenantMutation) ClearSignCertCACert()

ClearSignCertCACert clears the value of the "signCertCACert" field.

func (*TenantMutation) ClearSignCertCAPrivateKey

func (m *TenantMutation) ClearSignCertCAPrivateKey()

ClearSignCertCAPrivateKey clears the value of the "signCertCAPrivateKey" field.

func (*TenantMutation) ClearTlsCertCACert

func (m *TenantMutation) ClearTlsCertCACert()

ClearTlsCertCACert clears the value of the "tlsCertCACert" field.

func (*TenantMutation) ClearTlsCertCAPrivateKey

func (m *TenantMutation) ClearTlsCertCAPrivateKey()

ClearTlsCertCAPrivateKey clears the value of the "tlsCertCAPrivateKey" field.

func (*TenantMutation) ClearedEdges

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

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

func (*TenantMutation) ClearedFields

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

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

func (TenantMutation) Client

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

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

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*TenantMutation) Field

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

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

func (*TenantMutation) FieldCleared

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

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*TenantMutation) Fields

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

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

func (*TenantMutation) ID

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

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*TenantMutation) MspId

func (m *TenantMutation) MspId() (r string, exists bool)

MspId returns the value of the "mspId" field in the mutation.

func (*TenantMutation) Name

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

Name returns the value of the "name" field in the mutation.

func (*TenantMutation) OldField

func (m *TenantMutation) 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 failed.

func (*TenantMutation) OldMspId

func (m *TenantMutation) OldMspId(ctx context.Context) (v string, err error)

OldMspId returns the old "mspId" field's value of the Tenant entity. If the Tenant 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 the database query fails.

func (*TenantMutation) OldName

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

OldName returns the old "name" field's value of the Tenant entity. If the Tenant 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 the database query fails.

func (*TenantMutation) OldSignCertCACert

func (m *TenantMutation) OldSignCertCACert(ctx context.Context) (v []byte, err error)

OldSignCertCACert returns the old "signCertCACert" field's value of the Tenant entity. If the Tenant 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 the database query fails.

func (*TenantMutation) OldSignCertCAPrivateKey

func (m *TenantMutation) OldSignCertCAPrivateKey(ctx context.Context) (v []byte, err error)

OldSignCertCAPrivateKey returns the old "signCertCAPrivateKey" field's value of the Tenant entity. If the Tenant 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 the database query fails.

func (*TenantMutation) OldTlsCertCACert

func (m *TenantMutation) OldTlsCertCACert(ctx context.Context) (v []byte, err error)

OldTlsCertCACert returns the old "tlsCertCACert" field's value of the Tenant entity. If the Tenant 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 the database query fails.

func (*TenantMutation) OldTlsCertCAPrivateKey

func (m *TenantMutation) OldTlsCertCAPrivateKey(ctx context.Context) (v []byte, err error)

OldTlsCertCAPrivateKey returns the old "tlsCertCAPrivateKey" field's value of the Tenant entity. If the Tenant 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 the database query fails.

func (*TenantMutation) Op

func (m *TenantMutation) Op() Op

Op returns the operation name.

func (*TenantMutation) RemoveChaincodeIDs

func (m *TenantMutation) RemoveChaincodeIDs(ids ...int)

RemoveChaincodeIDs removes the "chaincodes" edge to the Chaincode entity by IDs.

func (*TenantMutation) RemovedChaincodesIDs

func (m *TenantMutation) RemovedChaincodesIDs() (ids []int)

RemovedChaincodes returns the removed IDs of the "chaincodes" edge to the Chaincode entity.

func (*TenantMutation) RemovedEdges

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

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

func (*TenantMutation) RemovedIDs

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

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*TenantMutation) ResetChaincodes

func (m *TenantMutation) ResetChaincodes()

ResetChaincodes resets all changes to the "chaincodes" edge.

func (*TenantMutation) ResetEdge

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

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

func (*TenantMutation) ResetField

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

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

func (*TenantMutation) ResetMspId

func (m *TenantMutation) ResetMspId()

ResetMspId resets all changes to the "mspId" field.

func (*TenantMutation) ResetName

func (m *TenantMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*TenantMutation) ResetSignCertCACert

func (m *TenantMutation) ResetSignCertCACert()

ResetSignCertCACert resets all changes to the "signCertCACert" field.

func (*TenantMutation) ResetSignCertCAPrivateKey

func (m *TenantMutation) ResetSignCertCAPrivateKey()

ResetSignCertCAPrivateKey resets all changes to the "signCertCAPrivateKey" field.

func (*TenantMutation) ResetTlsCertCACert

func (m *TenantMutation) ResetTlsCertCACert()

ResetTlsCertCACert resets all changes to the "tlsCertCACert" field.

func (*TenantMutation) ResetTlsCertCAPrivateKey

func (m *TenantMutation) ResetTlsCertCAPrivateKey()

ResetTlsCertCAPrivateKey resets all changes to the "tlsCertCAPrivateKey" field.

func (*TenantMutation) SetField

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

SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*TenantMutation) SetMspId

func (m *TenantMutation) SetMspId(s string)

SetMspId sets the "mspId" field.

func (*TenantMutation) SetName

func (m *TenantMutation) SetName(s string)

SetName sets the "name" field.

func (*TenantMutation) SetSignCertCACert

func (m *TenantMutation) SetSignCertCACert(b []byte)

SetSignCertCACert sets the "signCertCACert" field.

func (*TenantMutation) SetSignCertCAPrivateKey

func (m *TenantMutation) SetSignCertCAPrivateKey(b []byte)

SetSignCertCAPrivateKey sets the "signCertCAPrivateKey" field.

func (*TenantMutation) SetTlsCertCACert

func (m *TenantMutation) SetTlsCertCACert(b []byte)

SetTlsCertCACert sets the "tlsCertCACert" field.

func (*TenantMutation) SetTlsCertCAPrivateKey

func (m *TenantMutation) SetTlsCertCAPrivateKey(b []byte)

SetTlsCertCAPrivateKey sets the "tlsCertCAPrivateKey" field.

func (*TenantMutation) SignCertCACert

func (m *TenantMutation) SignCertCACert() (r []byte, exists bool)

SignCertCACert returns the value of the "signCertCACert" field in the mutation.

func (*TenantMutation) SignCertCACertCleared

func (m *TenantMutation) SignCertCACertCleared() bool

SignCertCACertCleared returns if the "signCertCACert" field was cleared in this mutation.

func (*TenantMutation) SignCertCAPrivateKey

func (m *TenantMutation) SignCertCAPrivateKey() (r []byte, exists bool)

SignCertCAPrivateKey returns the value of the "signCertCAPrivateKey" field in the mutation.

func (*TenantMutation) SignCertCAPrivateKeyCleared

func (m *TenantMutation) SignCertCAPrivateKeyCleared() bool

SignCertCAPrivateKeyCleared returns if the "signCertCAPrivateKey" field was cleared in this mutation.

func (*TenantMutation) TlsCertCACert

func (m *TenantMutation) TlsCertCACert() (r []byte, exists bool)

TlsCertCACert returns the value of the "tlsCertCACert" field in the mutation.

func (*TenantMutation) TlsCertCACertCleared

func (m *TenantMutation) TlsCertCACertCleared() bool

TlsCertCACertCleared returns if the "tlsCertCACert" field was cleared in this mutation.

func (*TenantMutation) TlsCertCAPrivateKey

func (m *TenantMutation) TlsCertCAPrivateKey() (r []byte, exists bool)

TlsCertCAPrivateKey returns the value of the "tlsCertCAPrivateKey" field in the mutation.

func (*TenantMutation) TlsCertCAPrivateKeyCleared

func (m *TenantMutation) TlsCertCAPrivateKeyCleared() bool

TlsCertCAPrivateKeyCleared returns if the "tlsCertCAPrivateKey" field was cleared in this mutation.

func (TenantMutation) Tx

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

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

func (*TenantMutation) Type

func (m *TenantMutation) Type() string

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

func (*TenantMutation) Where

func (m *TenantMutation) Where(ps ...predicate.Tenant)

Where appends a list predicates to the TenantMutation builder.

type TenantQuery

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

TenantQuery is the builder for querying Tenant entities.

func (*TenantQuery) All

func (tq *TenantQuery) All(ctx context.Context) ([]*Tenant, error)

All executes the query and returns a list of Tenants.

func (*TenantQuery) AllX

func (tq *TenantQuery) AllX(ctx context.Context) []*Tenant

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

func (*TenantQuery) Clone

func (tq *TenantQuery) Clone() *TenantQuery

Clone returns a duplicate of the TenantQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*TenantQuery) Count

func (tq *TenantQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*TenantQuery) CountX

func (tq *TenantQuery) CountX(ctx context.Context) int

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

func (*TenantQuery) Exist

func (tq *TenantQuery) Exist(ctx context.Context) (bool, error)

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

func (*TenantQuery) ExistX

func (tq *TenantQuery) ExistX(ctx context.Context) bool

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

func (*TenantQuery) First

func (tq *TenantQuery) First(ctx context.Context) (*Tenant, error)

First returns the first Tenant entity from the query. Returns a *NotFoundError when no Tenant was found.

func (*TenantQuery) FirstID

func (tq *TenantQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first Tenant ID from the query. Returns a *NotFoundError when no Tenant ID was found.

func (*TenantQuery) FirstIDX

func (tq *TenantQuery) FirstIDX(ctx context.Context) int

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

func (*TenantQuery) FirstX

func (tq *TenantQuery) FirstX(ctx context.Context) *Tenant

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

func (*TenantQuery) GroupBy

func (tq *TenantQuery) GroupBy(field string, fields ...string) *TenantGroupBy

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

func (*TenantQuery) IDs

func (tq *TenantQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of Tenant IDs.

func (*TenantQuery) IDsX

func (tq *TenantQuery) IDsX(ctx context.Context) []int

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

func (*TenantQuery) Limit

func (tq *TenantQuery) Limit(limit int) *TenantQuery

Limit adds a limit step to the query.

func (*TenantQuery) Offset

func (tq *TenantQuery) Offset(offset int) *TenantQuery

Offset adds an offset step to the query.

func (*TenantQuery) Only

func (tq *TenantQuery) Only(ctx context.Context) (*Tenant, error)

Only returns a single Tenant entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one Tenant entity is not found. Returns a *NotFoundError when no Tenant entities are found.

func (*TenantQuery) OnlyID

func (tq *TenantQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only Tenant ID in the query. Returns a *NotSingularError when exactly one Tenant ID is not found. Returns a *NotFoundError when no entities are found.

func (*TenantQuery) OnlyIDX

func (tq *TenantQuery) OnlyIDX(ctx context.Context) int

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

func (*TenantQuery) OnlyX

func (tq *TenantQuery) OnlyX(ctx context.Context) *Tenant

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

func (*TenantQuery) Order

func (tq *TenantQuery) Order(o ...OrderFunc) *TenantQuery

Order adds an order step to the query.

func (*TenantQuery) QueryChaincodes

func (tq *TenantQuery) QueryChaincodes() *ChaincodeQuery

QueryChaincodes chains the current query on the "chaincodes" edge.

func (*TenantQuery) Select

func (tq *TenantQuery) Select(fields ...string) *TenantSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

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

client.Tenant.Query().
	Select(tenant.FieldName).
	Scan(ctx, &v)

func (*TenantQuery) Unique

func (tq *TenantQuery) Unique(unique bool) *TenantQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*TenantQuery) Where

func (tq *TenantQuery) Where(ps ...predicate.Tenant) *TenantQuery

Where adds a new predicate for the TenantQuery builder.

func (*TenantQuery) WithChaincodes

func (tq *TenantQuery) WithChaincodes(opts ...func(*ChaincodeQuery)) *TenantQuery

WithChaincodes tells the query-builder to eager-load the nodes that are connected to the "chaincodes" edge. The optional arguments are used to configure the query builder of the edge.

type TenantSelect

type TenantSelect struct {
	*TenantQuery
	// contains filtered or unexported fields
}

TenantSelect is the builder for selecting fields of Tenant entities.

func (*TenantSelect) Bool

func (ts *TenantSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*TenantSelect) BoolX

func (ts *TenantSelect) BoolX(ctx context.Context) bool

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

func (*TenantSelect) Bools

func (ts *TenantSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*TenantSelect) BoolsX

func (ts *TenantSelect) BoolsX(ctx context.Context) []bool

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

func (*TenantSelect) Float64

func (ts *TenantSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*TenantSelect) Float64X

func (ts *TenantSelect) Float64X(ctx context.Context) float64

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

func (*TenantSelect) Float64s

func (ts *TenantSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*TenantSelect) Float64sX

func (ts *TenantSelect) Float64sX(ctx context.Context) []float64

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

func (*TenantSelect) Int

func (ts *TenantSelect) Int(ctx context.Context) (_ int, err error)

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

func (*TenantSelect) IntX

func (ts *TenantSelect) IntX(ctx context.Context) int

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

func (*TenantSelect) Ints

func (ts *TenantSelect) Ints(ctx context.Context) ([]int, error)

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

func (*TenantSelect) IntsX

func (ts *TenantSelect) IntsX(ctx context.Context) []int

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

func (*TenantSelect) Scan

func (ts *TenantSelect) Scan(ctx context.Context, v interface{}) error

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

func (*TenantSelect) ScanX

func (ts *TenantSelect) ScanX(ctx context.Context, v interface{})

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

func (*TenantSelect) String

func (ts *TenantSelect) String(ctx context.Context) (_ string, err error)

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

func (*TenantSelect) StringX

func (ts *TenantSelect) StringX(ctx context.Context) string

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

func (*TenantSelect) Strings

func (ts *TenantSelect) Strings(ctx context.Context) ([]string, error)

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

func (*TenantSelect) StringsX

func (ts *TenantSelect) StringsX(ctx context.Context) []string

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

type TenantUpdate

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

TenantUpdate is the builder for updating Tenant entities.

func (*TenantUpdate) AddChaincodeIDs

func (tu *TenantUpdate) AddChaincodeIDs(ids ...int) *TenantUpdate

AddChaincodeIDs adds the "chaincodes" edge to the Chaincode entity by IDs.

func (*TenantUpdate) AddChaincodes

func (tu *TenantUpdate) AddChaincodes(c ...*Chaincode) *TenantUpdate

AddChaincodes adds the "chaincodes" edges to the Chaincode entity.

func (*TenantUpdate) ClearChaincodes

func (tu *TenantUpdate) ClearChaincodes() *TenantUpdate

ClearChaincodes clears all "chaincodes" edges to the Chaincode entity.

func (*TenantUpdate) ClearSignCertCACert

func (tu *TenantUpdate) ClearSignCertCACert() *TenantUpdate

ClearSignCertCACert clears the value of the "signCertCACert" field.

func (*TenantUpdate) ClearSignCertCAPrivateKey

func (tu *TenantUpdate) ClearSignCertCAPrivateKey() *TenantUpdate

ClearSignCertCAPrivateKey clears the value of the "signCertCAPrivateKey" field.

func (*TenantUpdate) ClearTlsCertCACert

func (tu *TenantUpdate) ClearTlsCertCACert() *TenantUpdate

ClearTlsCertCACert clears the value of the "tlsCertCACert" field.

func (*TenantUpdate) ClearTlsCertCAPrivateKey

func (tu *TenantUpdate) ClearTlsCertCAPrivateKey() *TenantUpdate

ClearTlsCertCAPrivateKey clears the value of the "tlsCertCAPrivateKey" field.

func (*TenantUpdate) Exec

func (tu *TenantUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*TenantUpdate) ExecX

func (tu *TenantUpdate) ExecX(ctx context.Context)

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

func (*TenantUpdate) Mutation

func (tu *TenantUpdate) Mutation() *TenantMutation

Mutation returns the TenantMutation object of the builder.

func (*TenantUpdate) RemoveChaincodeIDs

func (tu *TenantUpdate) RemoveChaincodeIDs(ids ...int) *TenantUpdate

RemoveChaincodeIDs removes the "chaincodes" edge to Chaincode entities by IDs.

func (*TenantUpdate) RemoveChaincodes

func (tu *TenantUpdate) RemoveChaincodes(c ...*Chaincode) *TenantUpdate

RemoveChaincodes removes "chaincodes" edges to Chaincode entities.

func (*TenantUpdate) Save

func (tu *TenantUpdate) Save(ctx context.Context) (int, error)

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

func (*TenantUpdate) SaveX

func (tu *TenantUpdate) SaveX(ctx context.Context) int

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

func (*TenantUpdate) SetMspId

func (tu *TenantUpdate) SetMspId(s string) *TenantUpdate

SetMspId sets the "mspId" field.

func (*TenantUpdate) SetName

func (tu *TenantUpdate) SetName(s string) *TenantUpdate

SetName sets the "name" field.

func (*TenantUpdate) SetSignCertCACert

func (tu *TenantUpdate) SetSignCertCACert(b []byte) *TenantUpdate

SetSignCertCACert sets the "signCertCACert" field.

func (*TenantUpdate) SetSignCertCAPrivateKey

func (tu *TenantUpdate) SetSignCertCAPrivateKey(b []byte) *TenantUpdate

SetSignCertCAPrivateKey sets the "signCertCAPrivateKey" field.

func (*TenantUpdate) SetTlsCertCACert

func (tu *TenantUpdate) SetTlsCertCACert(b []byte) *TenantUpdate

SetTlsCertCACert sets the "tlsCertCACert" field.

func (*TenantUpdate) SetTlsCertCAPrivateKey

func (tu *TenantUpdate) SetTlsCertCAPrivateKey(b []byte) *TenantUpdate

SetTlsCertCAPrivateKey sets the "tlsCertCAPrivateKey" field.

func (*TenantUpdate) Where

func (tu *TenantUpdate) Where(ps ...predicate.Tenant) *TenantUpdate

Where appends a list predicates to the TenantUpdate builder.

type TenantUpdateOne

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

TenantUpdateOne is the builder for updating a single Tenant entity.

func (*TenantUpdateOne) AddChaincodeIDs

func (tuo *TenantUpdateOne) AddChaincodeIDs(ids ...int) *TenantUpdateOne

AddChaincodeIDs adds the "chaincodes" edge to the Chaincode entity by IDs.

func (*TenantUpdateOne) AddChaincodes

func (tuo *TenantUpdateOne) AddChaincodes(c ...*Chaincode) *TenantUpdateOne

AddChaincodes adds the "chaincodes" edges to the Chaincode entity.

func (*TenantUpdateOne) ClearChaincodes

func (tuo *TenantUpdateOne) ClearChaincodes() *TenantUpdateOne

ClearChaincodes clears all "chaincodes" edges to the Chaincode entity.

func (*TenantUpdateOne) ClearSignCertCACert

func (tuo *TenantUpdateOne) ClearSignCertCACert() *TenantUpdateOne

ClearSignCertCACert clears the value of the "signCertCACert" field.

func (*TenantUpdateOne) ClearSignCertCAPrivateKey

func (tuo *TenantUpdateOne) ClearSignCertCAPrivateKey() *TenantUpdateOne

ClearSignCertCAPrivateKey clears the value of the "signCertCAPrivateKey" field.

func (*TenantUpdateOne) ClearTlsCertCACert

func (tuo *TenantUpdateOne) ClearTlsCertCACert() *TenantUpdateOne

ClearTlsCertCACert clears the value of the "tlsCertCACert" field.

func (*TenantUpdateOne) ClearTlsCertCAPrivateKey

func (tuo *TenantUpdateOne) ClearTlsCertCAPrivateKey() *TenantUpdateOne

ClearTlsCertCAPrivateKey clears the value of the "tlsCertCAPrivateKey" field.

func (*TenantUpdateOne) Exec

func (tuo *TenantUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*TenantUpdateOne) ExecX

func (tuo *TenantUpdateOne) ExecX(ctx context.Context)

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

func (*TenantUpdateOne) Mutation

func (tuo *TenantUpdateOne) Mutation() *TenantMutation

Mutation returns the TenantMutation object of the builder.

func (*TenantUpdateOne) RemoveChaincodeIDs

func (tuo *TenantUpdateOne) RemoveChaincodeIDs(ids ...int) *TenantUpdateOne

RemoveChaincodeIDs removes the "chaincodes" edge to Chaincode entities by IDs.

func (*TenantUpdateOne) RemoveChaincodes

func (tuo *TenantUpdateOne) RemoveChaincodes(c ...*Chaincode) *TenantUpdateOne

RemoveChaincodes removes "chaincodes" edges to Chaincode entities.

func (*TenantUpdateOne) Save

func (tuo *TenantUpdateOne) Save(ctx context.Context) (*Tenant, error)

Save executes the query and returns the updated Tenant entity.

func (*TenantUpdateOne) SaveX

func (tuo *TenantUpdateOne) SaveX(ctx context.Context) *Tenant

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

func (*TenantUpdateOne) Select

func (tuo *TenantUpdateOne) Select(field string, fields ...string) *TenantUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*TenantUpdateOne) SetMspId

func (tuo *TenantUpdateOne) SetMspId(s string) *TenantUpdateOne

SetMspId sets the "mspId" field.

func (*TenantUpdateOne) SetName

func (tuo *TenantUpdateOne) SetName(s string) *TenantUpdateOne

SetName sets the "name" field.

func (*TenantUpdateOne) SetSignCertCACert

func (tuo *TenantUpdateOne) SetSignCertCACert(b []byte) *TenantUpdateOne

SetSignCertCACert sets the "signCertCACert" field.

func (*TenantUpdateOne) SetSignCertCAPrivateKey

func (tuo *TenantUpdateOne) SetSignCertCAPrivateKey(b []byte) *TenantUpdateOne

SetSignCertCAPrivateKey sets the "signCertCAPrivateKey" field.

func (*TenantUpdateOne) SetTlsCertCACert

func (tuo *TenantUpdateOne) SetTlsCertCACert(b []byte) *TenantUpdateOne

SetTlsCertCACert sets the "tlsCertCACert" field.

func (*TenantUpdateOne) SetTlsCertCAPrivateKey

func (tuo *TenantUpdateOne) SetTlsCertCAPrivateKey(b []byte) *TenantUpdateOne

SetTlsCertCAPrivateKey sets the "tlsCertCAPrivateKey" field.

type Tenants

type Tenants []*Tenant

Tenants is a parsable slice of Tenant.

type Tx

type Tx struct {

	// Chaincode is the client for interacting with the Chaincode builders.
	Chaincode *ChaincodeClient
	// Tenant is the client for interacting with the Tenant builders.
	Tenant *TenantClient
	// 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 a Tx stored inside 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 conflicts 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