ent

package
v0.0.0-...-36ab9e0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: GPL-3.0 Imports: 15 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.
	TypeThreat = "Threat"
)

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 Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Threat is the client for interacting with the Threat builders.
	Threat *ThreatClient
	// 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().
	Threat.
	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(ctx 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 Commit 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(ctx 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 Rollback method.

type Threat

type Threat struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// IP holds the value of the "ip" field.
	IP string `json:"ip,omitempty"`
	// ThreatIDInfo holds the value of the "threat_id_info" field.
	ThreatIDInfo string `json:"threat_id_info,omitempty"`
	// DomainCount holds the value of the "domain_count" field.
	DomainCount int `json:"domain_count,omitempty"`
	// TagCount holds the value of the "tag_count" field.
	TagCount int `json:"tag_count,omitempty"`
	// ItelCount holds the value of the "itel_count" field.
	ItelCount int `json:"itel_count,omitempty"`
	// Judge holds the value of the "judge" field.
	Judge int `json:"judge,omitempty"`
	// Poc holds the value of the "poc" field.
	Poc bool `json:"poc,omitempty"`
	// Source holds the value of the "source" field.
	Source int `json:"source,omitempty"`
	// Ctime holds the value of the "ctime" field.
	Ctime int64 `json:"ctime,omitempty"`
	// contains filtered or unexported fields
}

Threat is the model entity for the Threat schema.

func (*Threat) String

func (t *Threat) String() string

String implements the fmt.Stringer.

func (*Threat) Unwrap

func (t *Threat) Unwrap() *Threat

Unwrap unwraps the Threat 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 (*Threat) Update

func (t *Threat) Update() *ThreatUpdateOne

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

type ThreatClient

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

ThreatClient is a client for the Threat schema.

func NewThreatClient

func NewThreatClient(c config) *ThreatClient

NewThreatClient returns a client for the Threat from the given config.

func (*ThreatClient) Create

func (c *ThreatClient) Create() *ThreatCreate

Create returns a builder for creating a Threat entity.

func (*ThreatClient) CreateBulk

func (c *ThreatClient) CreateBulk(builders ...*ThreatCreate) *ThreatCreateBulk

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

func (*ThreatClient) Delete

func (c *ThreatClient) Delete() *ThreatDelete

Delete returns a delete builder for Threat.

func (*ThreatClient) DeleteOne

func (c *ThreatClient) DeleteOne(t *Threat) *ThreatDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*ThreatClient) DeleteOneID

func (c *ThreatClient) DeleteOneID(id int) *ThreatDeleteOne

DeleteOne returns a builder for deleting the given entity by its id.

func (*ThreatClient) Get

func (c *ThreatClient) Get(ctx context.Context, id int) (*Threat, error)

Get returns a Threat entity by its id.

func (*ThreatClient) GetX

func (c *ThreatClient) GetX(ctx context.Context, id int) *Threat

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

func (*ThreatClient) Hooks

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

Hooks returns the client hooks.

func (*ThreatClient) Query

func (c *ThreatClient) Query() *ThreatQuery

Query returns a query builder for Threat.

func (*ThreatClient) Update

func (c *ThreatClient) Update() *ThreatUpdate

Update returns an update builder for Threat.

func (*ThreatClient) UpdateOne

func (c *ThreatClient) UpdateOne(t *Threat) *ThreatUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ThreatClient) UpdateOneID

func (c *ThreatClient) UpdateOneID(id int) *ThreatUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ThreatClient) Use

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

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

type ThreatCreate

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

ThreatCreate is the builder for creating a Threat entity.

func (*ThreatCreate) Exec

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

Exec executes the query.

func (*ThreatCreate) ExecX

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

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

func (*ThreatCreate) Mutation

func (tc *ThreatCreate) Mutation() *ThreatMutation

Mutation returns the ThreatMutation object of the builder.

func (*ThreatCreate) Save

func (tc *ThreatCreate) Save(ctx context.Context) (*Threat, error)

Save creates the Threat in the database.

func (*ThreatCreate) SaveX

func (tc *ThreatCreate) SaveX(ctx context.Context) *Threat

SaveX calls Save and panics if Save returns an error.

func (*ThreatCreate) SetCtime

func (tc *ThreatCreate) SetCtime(i int64) *ThreatCreate

SetCtime sets the "ctime" field.

func (*ThreatCreate) SetDomainCount

func (tc *ThreatCreate) SetDomainCount(i int) *ThreatCreate

SetDomainCount sets the "domain_count" field.

func (*ThreatCreate) SetID

func (tc *ThreatCreate) SetID(i int) *ThreatCreate

SetID sets the "id" field.

func (*ThreatCreate) SetIP

func (tc *ThreatCreate) SetIP(s string) *ThreatCreate

SetIP sets the "ip" field.

func (*ThreatCreate) SetItelCount

func (tc *ThreatCreate) SetItelCount(i int) *ThreatCreate

SetItelCount sets the "itel_count" field.

func (*ThreatCreate) SetJudge

func (tc *ThreatCreate) SetJudge(i int) *ThreatCreate

SetJudge sets the "judge" field.

func (*ThreatCreate) SetPoc

func (tc *ThreatCreate) SetPoc(b bool) *ThreatCreate

SetPoc sets the "poc" field.

func (*ThreatCreate) SetSource

func (tc *ThreatCreate) SetSource(i int) *ThreatCreate

SetSource sets the "source" field.

func (*ThreatCreate) SetTagCount

func (tc *ThreatCreate) SetTagCount(i int) *ThreatCreate

SetTagCount sets the "tag_count" field.

func (*ThreatCreate) SetThreatIDInfo

func (tc *ThreatCreate) SetThreatIDInfo(s string) *ThreatCreate

SetThreatIDInfo sets the "threat_id_info" field.

type ThreatCreateBulk

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

ThreatCreateBulk is the builder for creating many Threat entities in bulk.

func (*ThreatCreateBulk) Exec

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

Exec executes the query.

func (*ThreatCreateBulk) ExecX

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

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

func (*ThreatCreateBulk) Save

func (tcb *ThreatCreateBulk) Save(ctx context.Context) ([]*Threat, error)

Save creates the Threat entities in the database.

func (*ThreatCreateBulk) SaveX

func (tcb *ThreatCreateBulk) SaveX(ctx context.Context) []*Threat

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

type ThreatDelete

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

ThreatDelete is the builder for deleting a Threat entity.

func (*ThreatDelete) Exec

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

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

func (*ThreatDelete) ExecX

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

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

func (*ThreatDelete) Where

func (td *ThreatDelete) Where(ps ...predicate.Threat) *ThreatDelete

Where appends a list predicates to the ThreatDelete builder.

type ThreatDeleteOne

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

ThreatDeleteOne is the builder for deleting a single Threat entity.

func (*ThreatDeleteOne) Exec

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

Exec executes the deletion query.

func (*ThreatDeleteOne) ExecX

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

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

type ThreatGroupBy

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

ThreatGroupBy is the group-by builder for Threat entities.

func (*ThreatGroupBy) Aggregate

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

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

func (*ThreatGroupBy) Bool

func (s *ThreatGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*ThreatGroupBy) BoolX

func (s *ThreatGroupBy) BoolX(ctx context.Context) bool

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

func (*ThreatGroupBy) Bools

func (s *ThreatGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*ThreatGroupBy) BoolsX

func (s *ThreatGroupBy) BoolsX(ctx context.Context) []bool

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

func (*ThreatGroupBy) Float64

func (s *ThreatGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*ThreatGroupBy) Float64X

func (s *ThreatGroupBy) Float64X(ctx context.Context) float64

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

func (*ThreatGroupBy) Float64s

func (s *ThreatGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*ThreatGroupBy) Float64sX

func (s *ThreatGroupBy) Float64sX(ctx context.Context) []float64

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

func (*ThreatGroupBy) Int

func (s *ThreatGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*ThreatGroupBy) IntX

func (s *ThreatGroupBy) IntX(ctx context.Context) int

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

func (*ThreatGroupBy) Ints

func (s *ThreatGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*ThreatGroupBy) IntsX

func (s *ThreatGroupBy) IntsX(ctx context.Context) []int

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

func (*ThreatGroupBy) Scan

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

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

func (*ThreatGroupBy) ScanX

func (s *ThreatGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*ThreatGroupBy) String

func (s *ThreatGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*ThreatGroupBy) StringX

func (s *ThreatGroupBy) StringX(ctx context.Context) string

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

func (*ThreatGroupBy) Strings

func (s *ThreatGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*ThreatGroupBy) StringsX

func (s *ThreatGroupBy) StringsX(ctx context.Context) []string

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

type ThreatMutation

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

ThreatMutation represents an operation that mutates the Threat nodes in the graph.

func (*ThreatMutation) AddCtime

func (m *ThreatMutation) AddCtime(i int64)

AddCtime adds i to the "ctime" field.

func (*ThreatMutation) AddDomainCount

func (m *ThreatMutation) AddDomainCount(i int)

AddDomainCount adds i to the "domain_count" field.

func (*ThreatMutation) AddField

func (m *ThreatMutation) 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 (*ThreatMutation) AddItelCount

func (m *ThreatMutation) AddItelCount(i int)

AddItelCount adds i to the "itel_count" field.

func (*ThreatMutation) AddJudge

func (m *ThreatMutation) AddJudge(i int)

AddJudge adds i to the "judge" field.

func (*ThreatMutation) AddSource

func (m *ThreatMutation) AddSource(i int)

AddSource adds i to the "source" field.

func (*ThreatMutation) AddTagCount

func (m *ThreatMutation) AddTagCount(i int)

AddTagCount adds i to the "tag_count" field.

func (*ThreatMutation) AddedCtime

func (m *ThreatMutation) AddedCtime() (r int64, exists bool)

AddedCtime returns the value that was added to the "ctime" field in this mutation.

func (*ThreatMutation) AddedDomainCount

func (m *ThreatMutation) AddedDomainCount() (r int, exists bool)

AddedDomainCount returns the value that was added to the "domain_count" field in this mutation.

func (*ThreatMutation) AddedEdges

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

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

func (*ThreatMutation) AddedField

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

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

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

func (*ThreatMutation) AddedIDs

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

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

func (*ThreatMutation) AddedItelCount

func (m *ThreatMutation) AddedItelCount() (r int, exists bool)

AddedItelCount returns the value that was added to the "itel_count" field in this mutation.

func (*ThreatMutation) AddedJudge

func (m *ThreatMutation) AddedJudge() (r int, exists bool)

AddedJudge returns the value that was added to the "judge" field in this mutation.

func (*ThreatMutation) AddedSource

func (m *ThreatMutation) AddedSource() (r int, exists bool)

AddedSource returns the value that was added to the "source" field in this mutation.

func (*ThreatMutation) AddedTagCount

func (m *ThreatMutation) AddedTagCount() (r int, exists bool)

AddedTagCount returns the value that was added to the "tag_count" field in this mutation.

func (*ThreatMutation) ClearEdge

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

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

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

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

func (*ThreatMutation) ClearedFields

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

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

func (ThreatMutation) Client

func (m ThreatMutation) 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 (*ThreatMutation) Ctime

func (m *ThreatMutation) Ctime() (r int64, exists bool)

Ctime returns the value of the "ctime" field in the mutation.

func (*ThreatMutation) DomainCount

func (m *ThreatMutation) DomainCount() (r int, exists bool)

DomainCount returns the value of the "domain_count" field in the mutation.

func (*ThreatMutation) EdgeCleared

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

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

func (*ThreatMutation) Field

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

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

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

func (*ThreatMutation) Fields

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

func (m *ThreatMutation) 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 (*ThreatMutation) IDs

func (m *ThreatMutation) IDs(ctx context.Context) ([]int, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*ThreatMutation) IP

func (m *ThreatMutation) IP() (r string, exists bool)

IP returns the value of the "ip" field in the mutation.

func (*ThreatMutation) ItelCount

func (m *ThreatMutation) ItelCount() (r int, exists bool)

ItelCount returns the value of the "itel_count" field in the mutation.

func (*ThreatMutation) Judge

func (m *ThreatMutation) Judge() (r int, exists bool)

Judge returns the value of the "judge" field in the mutation.

func (*ThreatMutation) OldCtime

func (m *ThreatMutation) OldCtime(ctx context.Context) (v int64, err error)

OldCtime returns the old "ctime" field's value of the Threat entity. If the Threat 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 (*ThreatMutation) OldDomainCount

func (m *ThreatMutation) OldDomainCount(ctx context.Context) (v int, err error)

OldDomainCount returns the old "domain_count" field's value of the Threat entity. If the Threat 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 (*ThreatMutation) OldField

func (m *ThreatMutation) 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 (*ThreatMutation) OldIP

func (m *ThreatMutation) OldIP(ctx context.Context) (v string, err error)

OldIP returns the old "ip" field's value of the Threat entity. If the Threat 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 (*ThreatMutation) OldItelCount

func (m *ThreatMutation) OldItelCount(ctx context.Context) (v int, err error)

OldItelCount returns the old "itel_count" field's value of the Threat entity. If the Threat 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 (*ThreatMutation) OldJudge

func (m *ThreatMutation) OldJudge(ctx context.Context) (v int, err error)

OldJudge returns the old "judge" field's value of the Threat entity. If the Threat 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 (*ThreatMutation) OldPoc

func (m *ThreatMutation) OldPoc(ctx context.Context) (v bool, err error)

OldPoc returns the old "poc" field's value of the Threat entity. If the Threat 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 (*ThreatMutation) OldSource

func (m *ThreatMutation) OldSource(ctx context.Context) (v int, err error)

OldSource returns the old "source" field's value of the Threat entity. If the Threat 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 (*ThreatMutation) OldTagCount

func (m *ThreatMutation) OldTagCount(ctx context.Context) (v int, err error)

OldTagCount returns the old "tag_count" field's value of the Threat entity. If the Threat 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 (*ThreatMutation) OldThreatIDInfo

func (m *ThreatMutation) OldThreatIDInfo(ctx context.Context) (v string, err error)

OldThreatIDInfo returns the old "threat_id_info" field's value of the Threat entity. If the Threat 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 (*ThreatMutation) Op

func (m *ThreatMutation) Op() Op

Op returns the operation name.

func (*ThreatMutation) Poc

func (m *ThreatMutation) Poc() (r bool, exists bool)

Poc returns the value of the "poc" field in the mutation.

func (*ThreatMutation) RemovedEdges

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

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

func (*ThreatMutation) RemovedIDs

func (m *ThreatMutation) 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 (*ThreatMutation) ResetCtime

func (m *ThreatMutation) ResetCtime()

ResetCtime resets all changes to the "ctime" field.

func (*ThreatMutation) ResetDomainCount

func (m *ThreatMutation) ResetDomainCount()

ResetDomainCount resets all changes to the "domain_count" field.

func (*ThreatMutation) ResetEdge

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

func (m *ThreatMutation) 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 (*ThreatMutation) ResetIP

func (m *ThreatMutation) ResetIP()

ResetIP resets all changes to the "ip" field.

func (*ThreatMutation) ResetItelCount

func (m *ThreatMutation) ResetItelCount()

ResetItelCount resets all changes to the "itel_count" field.

func (*ThreatMutation) ResetJudge

func (m *ThreatMutation) ResetJudge()

ResetJudge resets all changes to the "judge" field.

func (*ThreatMutation) ResetPoc

func (m *ThreatMutation) ResetPoc()

ResetPoc resets all changes to the "poc" field.

func (*ThreatMutation) ResetSource

func (m *ThreatMutation) ResetSource()

ResetSource resets all changes to the "source" field.

func (*ThreatMutation) ResetTagCount

func (m *ThreatMutation) ResetTagCount()

ResetTagCount resets all changes to the "tag_count" field.

func (*ThreatMutation) ResetThreatIDInfo

func (m *ThreatMutation) ResetThreatIDInfo()

ResetThreatIDInfo resets all changes to the "threat_id_info" field.

func (*ThreatMutation) SetCtime

func (m *ThreatMutation) SetCtime(i int64)

SetCtime sets the "ctime" field.

func (*ThreatMutation) SetDomainCount

func (m *ThreatMutation) SetDomainCount(i int)

SetDomainCount sets the "domain_count" field.

func (*ThreatMutation) SetField

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

func (m *ThreatMutation) SetID(id int)

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

func (*ThreatMutation) SetIP

func (m *ThreatMutation) SetIP(s string)

SetIP sets the "ip" field.

func (*ThreatMutation) SetItelCount

func (m *ThreatMutation) SetItelCount(i int)

SetItelCount sets the "itel_count" field.

func (*ThreatMutation) SetJudge

func (m *ThreatMutation) SetJudge(i int)

SetJudge sets the "judge" field.

func (*ThreatMutation) SetPoc

func (m *ThreatMutation) SetPoc(b bool)

SetPoc sets the "poc" field.

func (*ThreatMutation) SetSource

func (m *ThreatMutation) SetSource(i int)

SetSource sets the "source" field.

func (*ThreatMutation) SetTagCount

func (m *ThreatMutation) SetTagCount(i int)

SetTagCount sets the "tag_count" field.

func (*ThreatMutation) SetThreatIDInfo

func (m *ThreatMutation) SetThreatIDInfo(s string)

SetThreatIDInfo sets the "threat_id_info" field.

func (*ThreatMutation) Source

func (m *ThreatMutation) Source() (r int, exists bool)

Source returns the value of the "source" field in the mutation.

func (*ThreatMutation) TagCount

func (m *ThreatMutation) TagCount() (r int, exists bool)

TagCount returns the value of the "tag_count" field in the mutation.

func (*ThreatMutation) ThreatIDInfo

func (m *ThreatMutation) ThreatIDInfo() (r string, exists bool)

ThreatIDInfo returns the value of the "threat_id_info" field in the mutation.

func (ThreatMutation) Tx

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

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

func (*ThreatMutation) Type

func (m *ThreatMutation) Type() string

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

func (*ThreatMutation) Where

func (m *ThreatMutation) Where(ps ...predicate.Threat)

Where appends a list predicates to the ThreatMutation builder.

type ThreatQuery

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

ThreatQuery is the builder for querying Threat entities.

func (*ThreatQuery) All

func (tq *ThreatQuery) All(ctx context.Context) ([]*Threat, error)

All executes the query and returns a list of Threats.

func (*ThreatQuery) AllX

func (tq *ThreatQuery) AllX(ctx context.Context) []*Threat

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

func (*ThreatQuery) Clone

func (tq *ThreatQuery) Clone() *ThreatQuery

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

func (*ThreatQuery) Count

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

Count returns the count of the given query.

func (*ThreatQuery) CountX

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

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

func (*ThreatQuery) Exist

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

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

func (*ThreatQuery) ExistX

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

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

func (*ThreatQuery) First

func (tq *ThreatQuery) First(ctx context.Context) (*Threat, error)

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

func (*ThreatQuery) FirstID

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

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

func (*ThreatQuery) FirstIDX

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

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

func (*ThreatQuery) FirstX

func (tq *ThreatQuery) FirstX(ctx context.Context) *Threat

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

func (*ThreatQuery) GroupBy

func (tq *ThreatQuery) GroupBy(field string, fields ...string) *ThreatGroupBy

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

client.Threat.Query().
	GroupBy(threat.FieldIP).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ThreatQuery) IDs

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

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

func (*ThreatQuery) IDsX

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

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

func (*ThreatQuery) Limit

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

Limit adds a limit step to the query.

func (*ThreatQuery) Offset

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

Offset adds an offset step to the query.

func (*ThreatQuery) Only

func (tq *ThreatQuery) Only(ctx context.Context) (*Threat, error)

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

func (*ThreatQuery) OnlyID

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

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

func (*ThreatQuery) OnlyIDX

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

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

func (*ThreatQuery) OnlyX

func (tq *ThreatQuery) OnlyX(ctx context.Context) *Threat

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

func (*ThreatQuery) Order

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

Order adds an order step to the query.

func (*ThreatQuery) Select

func (tq *ThreatQuery) Select(fields ...string) *ThreatSelect

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 {
	IP string `json:"ip,omitempty"`
}

client.Threat.Query().
	Select(threat.FieldIP).
	Scan(ctx, &v)

func (*ThreatQuery) Unique

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

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 (*ThreatQuery) Where

func (tq *ThreatQuery) Where(ps ...predicate.Threat) *ThreatQuery

Where adds a new predicate for the ThreatQuery builder.

type ThreatSelect

type ThreatSelect struct {
	*ThreatQuery
	// contains filtered or unexported fields
}

ThreatSelect is the builder for selecting fields of Threat entities.

func (*ThreatSelect) Bool

func (s *ThreatSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*ThreatSelect) BoolX

func (s *ThreatSelect) BoolX(ctx context.Context) bool

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

func (*ThreatSelect) Bools

func (s *ThreatSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*ThreatSelect) BoolsX

func (s *ThreatSelect) BoolsX(ctx context.Context) []bool

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

func (*ThreatSelect) Float64

func (s *ThreatSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*ThreatSelect) Float64X

func (s *ThreatSelect) Float64X(ctx context.Context) float64

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

func (*ThreatSelect) Float64s

func (s *ThreatSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*ThreatSelect) Float64sX

func (s *ThreatSelect) Float64sX(ctx context.Context) []float64

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

func (*ThreatSelect) Int

func (s *ThreatSelect) Int(ctx context.Context) (_ int, err error)

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

func (*ThreatSelect) IntX

func (s *ThreatSelect) IntX(ctx context.Context) int

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

func (*ThreatSelect) Ints

func (s *ThreatSelect) Ints(ctx context.Context) ([]int, error)

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

func (*ThreatSelect) IntsX

func (s *ThreatSelect) IntsX(ctx context.Context) []int

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

func (*ThreatSelect) Scan

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

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

func (*ThreatSelect) ScanX

func (s *ThreatSelect) ScanX(ctx context.Context, v interface{})

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

func (*ThreatSelect) String

func (s *ThreatSelect) String(ctx context.Context) (_ string, err error)

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

func (*ThreatSelect) StringX

func (s *ThreatSelect) StringX(ctx context.Context) string

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

func (*ThreatSelect) Strings

func (s *ThreatSelect) Strings(ctx context.Context) ([]string, error)

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

func (*ThreatSelect) StringsX

func (s *ThreatSelect) StringsX(ctx context.Context) []string

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

type ThreatUpdate

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

ThreatUpdate is the builder for updating Threat entities.

func (*ThreatUpdate) AddCtime

func (tu *ThreatUpdate) AddCtime(i int64) *ThreatUpdate

AddCtime adds i to the "ctime" field.

func (*ThreatUpdate) AddDomainCount

func (tu *ThreatUpdate) AddDomainCount(i int) *ThreatUpdate

AddDomainCount adds i to the "domain_count" field.

func (*ThreatUpdate) AddItelCount

func (tu *ThreatUpdate) AddItelCount(i int) *ThreatUpdate

AddItelCount adds i to the "itel_count" field.

func (*ThreatUpdate) AddJudge

func (tu *ThreatUpdate) AddJudge(i int) *ThreatUpdate

AddJudge adds i to the "judge" field.

func (*ThreatUpdate) AddSource

func (tu *ThreatUpdate) AddSource(i int) *ThreatUpdate

AddSource adds i to the "source" field.

func (*ThreatUpdate) AddTagCount

func (tu *ThreatUpdate) AddTagCount(i int) *ThreatUpdate

AddTagCount adds i to the "tag_count" field.

func (*ThreatUpdate) Exec

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

Exec executes the query.

func (*ThreatUpdate) ExecX

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

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

func (*ThreatUpdate) Mutation

func (tu *ThreatUpdate) Mutation() *ThreatMutation

Mutation returns the ThreatMutation object of the builder.

func (*ThreatUpdate) Save

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

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

func (*ThreatUpdate) SaveX

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

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

func (*ThreatUpdate) SetCtime

func (tu *ThreatUpdate) SetCtime(i int64) *ThreatUpdate

SetCtime sets the "ctime" field.

func (*ThreatUpdate) SetDomainCount

func (tu *ThreatUpdate) SetDomainCount(i int) *ThreatUpdate

SetDomainCount sets the "domain_count" field.

func (*ThreatUpdate) SetIP

func (tu *ThreatUpdate) SetIP(s string) *ThreatUpdate

SetIP sets the "ip" field.

func (*ThreatUpdate) SetItelCount

func (tu *ThreatUpdate) SetItelCount(i int) *ThreatUpdate

SetItelCount sets the "itel_count" field.

func (*ThreatUpdate) SetJudge

func (tu *ThreatUpdate) SetJudge(i int) *ThreatUpdate

SetJudge sets the "judge" field.

func (*ThreatUpdate) SetPoc

func (tu *ThreatUpdate) SetPoc(b bool) *ThreatUpdate

SetPoc sets the "poc" field.

func (*ThreatUpdate) SetSource

func (tu *ThreatUpdate) SetSource(i int) *ThreatUpdate

SetSource sets the "source" field.

func (*ThreatUpdate) SetTagCount

func (tu *ThreatUpdate) SetTagCount(i int) *ThreatUpdate

SetTagCount sets the "tag_count" field.

func (*ThreatUpdate) SetThreatIDInfo

func (tu *ThreatUpdate) SetThreatIDInfo(s string) *ThreatUpdate

SetThreatIDInfo sets the "threat_id_info" field.

func (*ThreatUpdate) Where

func (tu *ThreatUpdate) Where(ps ...predicate.Threat) *ThreatUpdate

Where appends a list predicates to the ThreatUpdate builder.

type ThreatUpdateOne

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

ThreatUpdateOne is the builder for updating a single Threat entity.

func (*ThreatUpdateOne) AddCtime

func (tuo *ThreatUpdateOne) AddCtime(i int64) *ThreatUpdateOne

AddCtime adds i to the "ctime" field.

func (*ThreatUpdateOne) AddDomainCount

func (tuo *ThreatUpdateOne) AddDomainCount(i int) *ThreatUpdateOne

AddDomainCount adds i to the "domain_count" field.

func (*ThreatUpdateOne) AddItelCount

func (tuo *ThreatUpdateOne) AddItelCount(i int) *ThreatUpdateOne

AddItelCount adds i to the "itel_count" field.

func (*ThreatUpdateOne) AddJudge

func (tuo *ThreatUpdateOne) AddJudge(i int) *ThreatUpdateOne

AddJudge adds i to the "judge" field.

func (*ThreatUpdateOne) AddSource

func (tuo *ThreatUpdateOne) AddSource(i int) *ThreatUpdateOne

AddSource adds i to the "source" field.

func (*ThreatUpdateOne) AddTagCount

func (tuo *ThreatUpdateOne) AddTagCount(i int) *ThreatUpdateOne

AddTagCount adds i to the "tag_count" field.

func (*ThreatUpdateOne) Exec

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

Exec executes the query on the entity.

func (*ThreatUpdateOne) ExecX

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

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

func (*ThreatUpdateOne) Mutation

func (tuo *ThreatUpdateOne) Mutation() *ThreatMutation

Mutation returns the ThreatMutation object of the builder.

func (*ThreatUpdateOne) Save

func (tuo *ThreatUpdateOne) Save(ctx context.Context) (*Threat, error)

Save executes the query and returns the updated Threat entity.

func (*ThreatUpdateOne) SaveX

func (tuo *ThreatUpdateOne) SaveX(ctx context.Context) *Threat

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

func (*ThreatUpdateOne) Select

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

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

func (*ThreatUpdateOne) SetCtime

func (tuo *ThreatUpdateOne) SetCtime(i int64) *ThreatUpdateOne

SetCtime sets the "ctime" field.

func (*ThreatUpdateOne) SetDomainCount

func (tuo *ThreatUpdateOne) SetDomainCount(i int) *ThreatUpdateOne

SetDomainCount sets the "domain_count" field.

func (*ThreatUpdateOne) SetIP

func (tuo *ThreatUpdateOne) SetIP(s string) *ThreatUpdateOne

SetIP sets the "ip" field.

func (*ThreatUpdateOne) SetItelCount

func (tuo *ThreatUpdateOne) SetItelCount(i int) *ThreatUpdateOne

SetItelCount sets the "itel_count" field.

func (*ThreatUpdateOne) SetJudge

func (tuo *ThreatUpdateOne) SetJudge(i int) *ThreatUpdateOne

SetJudge sets the "judge" field.

func (*ThreatUpdateOne) SetPoc

func (tuo *ThreatUpdateOne) SetPoc(b bool) *ThreatUpdateOne

SetPoc sets the "poc" field.

func (*ThreatUpdateOne) SetSource

func (tuo *ThreatUpdateOne) SetSource(i int) *ThreatUpdateOne

SetSource sets the "source" field.

func (*ThreatUpdateOne) SetTagCount

func (tuo *ThreatUpdateOne) SetTagCount(i int) *ThreatUpdateOne

SetTagCount sets the "tag_count" field.

func (*ThreatUpdateOne) SetThreatIDInfo

func (tuo *ThreatUpdateOne) SetThreatIDInfo(s string) *ThreatUpdateOne

SetThreatIDInfo sets the "threat_id_info" field.

type Threats

type Threats []*Threat

Threats is a parsable slice of Threat.

type Tx

type Tx struct {

	// Threat is the client for interacting with the Threat builders.
	Threat *ThreatClient
	// 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 or edge 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