Documentation ¶
Index ¶
- Constants
- func IsConstraintError(err error) bool
- func IsNotFound(err error) bool
- func IsNotLoaded(err error) bool
- func IsNotSingular(err error) bool
- func IsValidationError(err error) bool
- func MaskNotFound(err error) error
- func NewContext(parent context.Context, c *Client) context.Context
- func NewTxContext(parent context.Context, tx *Tx) context.Context
- type AggregateFunc
- type Client
- type CommitFunc
- type CommitHook
- type Committer
- type ConstraintError
- type Hook
- type MutateFunc
- type Mutation
- type Mutator
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type OrderFunc
- type Policy
- type Query
- type RollbackFunc
- type RollbackHook
- type Rollbacker
- type Threat
- type ThreatClient
- func (c *ThreatClient) Create() *ThreatCreate
- func (c *ThreatClient) CreateBulk(builders ...*ThreatCreate) *ThreatCreateBulk
- func (c *ThreatClient) Delete() *ThreatDelete
- func (c *ThreatClient) DeleteOne(t *Threat) *ThreatDeleteOne
- func (c *ThreatClient) DeleteOneID(id int) *ThreatDeleteOne
- func (c *ThreatClient) Get(ctx context.Context, id int) (*Threat, error)
- func (c *ThreatClient) GetX(ctx context.Context, id int) *Threat
- func (c *ThreatClient) Hooks() []Hook
- func (c *ThreatClient) Query() *ThreatQuery
- func (c *ThreatClient) Update() *ThreatUpdate
- func (c *ThreatClient) UpdateOne(t *Threat) *ThreatUpdateOne
- func (c *ThreatClient) UpdateOneID(id int) *ThreatUpdateOne
- func (c *ThreatClient) Use(hooks ...Hook)
- type ThreatCreate
- func (tc *ThreatCreate) Exec(ctx context.Context) error
- func (tc *ThreatCreate) ExecX(ctx context.Context)
- func (tc *ThreatCreate) Mutation() *ThreatMutation
- func (tc *ThreatCreate) Save(ctx context.Context) (*Threat, error)
- func (tc *ThreatCreate) SaveX(ctx context.Context) *Threat
- func (tc *ThreatCreate) SetCtime(i int64) *ThreatCreate
- func (tc *ThreatCreate) SetDomainCount(i int) *ThreatCreate
- func (tc *ThreatCreate) SetID(i int) *ThreatCreate
- func (tc *ThreatCreate) SetIP(s string) *ThreatCreate
- func (tc *ThreatCreate) SetItelCount(i int) *ThreatCreate
- func (tc *ThreatCreate) SetJudge(i int) *ThreatCreate
- func (tc *ThreatCreate) SetPoc(b bool) *ThreatCreate
- func (tc *ThreatCreate) SetSource(i int) *ThreatCreate
- func (tc *ThreatCreate) SetTagCount(i int) *ThreatCreate
- func (tc *ThreatCreate) SetThreatIDInfo(s string) *ThreatCreate
- type ThreatCreateBulk
- type ThreatDelete
- type ThreatDeleteOne
- type ThreatGroupBy
- func (tgb *ThreatGroupBy) Aggregate(fns ...AggregateFunc) *ThreatGroupBy
- func (s *ThreatGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *ThreatGroupBy) BoolX(ctx context.Context) bool
- func (s *ThreatGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *ThreatGroupBy) BoolsX(ctx context.Context) []bool
- func (s *ThreatGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *ThreatGroupBy) Float64X(ctx context.Context) float64
- func (s *ThreatGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *ThreatGroupBy) Float64sX(ctx context.Context) []float64
- func (s *ThreatGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *ThreatGroupBy) IntX(ctx context.Context) int
- func (s *ThreatGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *ThreatGroupBy) IntsX(ctx context.Context) []int
- func (tgb *ThreatGroupBy) Scan(ctx context.Context, v interface{}) error
- func (s *ThreatGroupBy) ScanX(ctx context.Context, v interface{})
- func (s *ThreatGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *ThreatGroupBy) StringX(ctx context.Context) string
- func (s *ThreatGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *ThreatGroupBy) StringsX(ctx context.Context) []string
- type ThreatMutation
- func (m *ThreatMutation) AddCtime(i int64)
- func (m *ThreatMutation) AddDomainCount(i int)
- func (m *ThreatMutation) AddField(name string, value ent.Value) error
- func (m *ThreatMutation) AddItelCount(i int)
- func (m *ThreatMutation) AddJudge(i int)
- func (m *ThreatMutation) AddSource(i int)
- func (m *ThreatMutation) AddTagCount(i int)
- func (m *ThreatMutation) AddedCtime() (r int64, exists bool)
- func (m *ThreatMutation) AddedDomainCount() (r int, exists bool)
- func (m *ThreatMutation) AddedEdges() []string
- func (m *ThreatMutation) AddedField(name string) (ent.Value, bool)
- func (m *ThreatMutation) AddedFields() []string
- func (m *ThreatMutation) AddedIDs(name string) []ent.Value
- func (m *ThreatMutation) AddedItelCount() (r int, exists bool)
- func (m *ThreatMutation) AddedJudge() (r int, exists bool)
- func (m *ThreatMutation) AddedSource() (r int, exists bool)
- func (m *ThreatMutation) AddedTagCount() (r int, exists bool)
- func (m *ThreatMutation) ClearEdge(name string) error
- func (m *ThreatMutation) ClearField(name string) error
- func (m *ThreatMutation) ClearedEdges() []string
- func (m *ThreatMutation) ClearedFields() []string
- func (m ThreatMutation) Client() *Client
- func (m *ThreatMutation) Ctime() (r int64, exists bool)
- func (m *ThreatMutation) DomainCount() (r int, exists bool)
- func (m *ThreatMutation) EdgeCleared(name string) bool
- func (m *ThreatMutation) Field(name string) (ent.Value, bool)
- func (m *ThreatMutation) FieldCleared(name string) bool
- func (m *ThreatMutation) Fields() []string
- func (m *ThreatMutation) ID() (id int, exists bool)
- func (m *ThreatMutation) IDs(ctx context.Context) ([]int, error)
- func (m *ThreatMutation) IP() (r string, exists bool)
- func (m *ThreatMutation) ItelCount() (r int, exists bool)
- func (m *ThreatMutation) Judge() (r int, exists bool)
- func (m *ThreatMutation) OldCtime(ctx context.Context) (v int64, err error)
- func (m *ThreatMutation) OldDomainCount(ctx context.Context) (v int, err error)
- func (m *ThreatMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *ThreatMutation) OldIP(ctx context.Context) (v string, err error)
- func (m *ThreatMutation) OldItelCount(ctx context.Context) (v int, err error)
- func (m *ThreatMutation) OldJudge(ctx context.Context) (v int, err error)
- func (m *ThreatMutation) OldPoc(ctx context.Context) (v bool, err error)
- func (m *ThreatMutation) OldSource(ctx context.Context) (v int, err error)
- func (m *ThreatMutation) OldTagCount(ctx context.Context) (v int, err error)
- func (m *ThreatMutation) OldThreatIDInfo(ctx context.Context) (v string, err error)
- func (m *ThreatMutation) Op() Op
- func (m *ThreatMutation) Poc() (r bool, exists bool)
- func (m *ThreatMutation) RemovedEdges() []string
- func (m *ThreatMutation) RemovedIDs(name string) []ent.Value
- func (m *ThreatMutation) ResetCtime()
- func (m *ThreatMutation) ResetDomainCount()
- func (m *ThreatMutation) ResetEdge(name string) error
- func (m *ThreatMutation) ResetField(name string) error
- func (m *ThreatMutation) ResetIP()
- func (m *ThreatMutation) ResetItelCount()
- func (m *ThreatMutation) ResetJudge()
- func (m *ThreatMutation) ResetPoc()
- func (m *ThreatMutation) ResetSource()
- func (m *ThreatMutation) ResetTagCount()
- func (m *ThreatMutation) ResetThreatIDInfo()
- func (m *ThreatMutation) SetCtime(i int64)
- func (m *ThreatMutation) SetDomainCount(i int)
- func (m *ThreatMutation) SetField(name string, value ent.Value) error
- func (m *ThreatMutation) SetID(id int)
- func (m *ThreatMutation) SetIP(s string)
- func (m *ThreatMutation) SetItelCount(i int)
- func (m *ThreatMutation) SetJudge(i int)
- func (m *ThreatMutation) SetPoc(b bool)
- func (m *ThreatMutation) SetSource(i int)
- func (m *ThreatMutation) SetTagCount(i int)
- func (m *ThreatMutation) SetThreatIDInfo(s string)
- func (m *ThreatMutation) Source() (r int, exists bool)
- func (m *ThreatMutation) TagCount() (r int, exists bool)
- func (m *ThreatMutation) ThreatIDInfo() (r string, exists bool)
- func (m ThreatMutation) Tx() (*Tx, error)
- func (m *ThreatMutation) Type() string
- func (m *ThreatMutation) Where(ps ...predicate.Threat)
- type ThreatQuery
- func (tq *ThreatQuery) All(ctx context.Context) ([]*Threat, error)
- func (tq *ThreatQuery) AllX(ctx context.Context) []*Threat
- func (tq *ThreatQuery) Clone() *ThreatQuery
- func (tq *ThreatQuery) Count(ctx context.Context) (int, error)
- func (tq *ThreatQuery) CountX(ctx context.Context) int
- func (tq *ThreatQuery) Exist(ctx context.Context) (bool, error)
- func (tq *ThreatQuery) ExistX(ctx context.Context) bool
- func (tq *ThreatQuery) First(ctx context.Context) (*Threat, error)
- func (tq *ThreatQuery) FirstID(ctx context.Context) (id int, err error)
- func (tq *ThreatQuery) FirstIDX(ctx context.Context) int
- func (tq *ThreatQuery) FirstX(ctx context.Context) *Threat
- func (tq *ThreatQuery) GroupBy(field string, fields ...string) *ThreatGroupBy
- func (tq *ThreatQuery) IDs(ctx context.Context) ([]int, error)
- func (tq *ThreatQuery) IDsX(ctx context.Context) []int
- func (tq *ThreatQuery) Limit(limit int) *ThreatQuery
- func (tq *ThreatQuery) Offset(offset int) *ThreatQuery
- func (tq *ThreatQuery) Only(ctx context.Context) (*Threat, error)
- func (tq *ThreatQuery) OnlyID(ctx context.Context) (id int, err error)
- func (tq *ThreatQuery) OnlyIDX(ctx context.Context) int
- func (tq *ThreatQuery) OnlyX(ctx context.Context) *Threat
- func (tq *ThreatQuery) Order(o ...OrderFunc) *ThreatQuery
- func (tq *ThreatQuery) Select(fields ...string) *ThreatSelect
- func (tq *ThreatQuery) Unique(unique bool) *ThreatQuery
- func (tq *ThreatQuery) Where(ps ...predicate.Threat) *ThreatQuery
- type ThreatSelect
- func (s *ThreatSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *ThreatSelect) BoolX(ctx context.Context) bool
- func (s *ThreatSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *ThreatSelect) BoolsX(ctx context.Context) []bool
- func (s *ThreatSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *ThreatSelect) Float64X(ctx context.Context) float64
- func (s *ThreatSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *ThreatSelect) Float64sX(ctx context.Context) []float64
- func (s *ThreatSelect) Int(ctx context.Context) (_ int, err error)
- func (s *ThreatSelect) IntX(ctx context.Context) int
- func (s *ThreatSelect) Ints(ctx context.Context) ([]int, error)
- func (s *ThreatSelect) IntsX(ctx context.Context) []int
- func (ts *ThreatSelect) Scan(ctx context.Context, v interface{}) error
- func (s *ThreatSelect) ScanX(ctx context.Context, v interface{})
- func (s *ThreatSelect) String(ctx context.Context) (_ string, err error)
- func (s *ThreatSelect) StringX(ctx context.Context) string
- func (s *ThreatSelect) Strings(ctx context.Context) ([]string, error)
- func (s *ThreatSelect) StringsX(ctx context.Context) []string
- type ThreatUpdate
- func (tu *ThreatUpdate) AddCtime(i int64) *ThreatUpdate
- func (tu *ThreatUpdate) AddDomainCount(i int) *ThreatUpdate
- func (tu *ThreatUpdate) AddItelCount(i int) *ThreatUpdate
- func (tu *ThreatUpdate) AddJudge(i int) *ThreatUpdate
- func (tu *ThreatUpdate) AddSource(i int) *ThreatUpdate
- func (tu *ThreatUpdate) AddTagCount(i int) *ThreatUpdate
- func (tu *ThreatUpdate) Exec(ctx context.Context) error
- func (tu *ThreatUpdate) ExecX(ctx context.Context)
- func (tu *ThreatUpdate) Mutation() *ThreatMutation
- func (tu *ThreatUpdate) Save(ctx context.Context) (int, error)
- func (tu *ThreatUpdate) SaveX(ctx context.Context) int
- func (tu *ThreatUpdate) SetCtime(i int64) *ThreatUpdate
- func (tu *ThreatUpdate) SetDomainCount(i int) *ThreatUpdate
- func (tu *ThreatUpdate) SetIP(s string) *ThreatUpdate
- func (tu *ThreatUpdate) SetItelCount(i int) *ThreatUpdate
- func (tu *ThreatUpdate) SetJudge(i int) *ThreatUpdate
- func (tu *ThreatUpdate) SetPoc(b bool) *ThreatUpdate
- func (tu *ThreatUpdate) SetSource(i int) *ThreatUpdate
- func (tu *ThreatUpdate) SetTagCount(i int) *ThreatUpdate
- func (tu *ThreatUpdate) SetThreatIDInfo(s string) *ThreatUpdate
- func (tu *ThreatUpdate) Where(ps ...predicate.Threat) *ThreatUpdate
- type ThreatUpdateOne
- func (tuo *ThreatUpdateOne) AddCtime(i int64) *ThreatUpdateOne
- func (tuo *ThreatUpdateOne) AddDomainCount(i int) *ThreatUpdateOne
- func (tuo *ThreatUpdateOne) AddItelCount(i int) *ThreatUpdateOne
- func (tuo *ThreatUpdateOne) AddJudge(i int) *ThreatUpdateOne
- func (tuo *ThreatUpdateOne) AddSource(i int) *ThreatUpdateOne
- func (tuo *ThreatUpdateOne) AddTagCount(i int) *ThreatUpdateOne
- func (tuo *ThreatUpdateOne) Exec(ctx context.Context) error
- func (tuo *ThreatUpdateOne) ExecX(ctx context.Context)
- func (tuo *ThreatUpdateOne) Mutation() *ThreatMutation
- func (tuo *ThreatUpdateOne) Save(ctx context.Context) (*Threat, error)
- func (tuo *ThreatUpdateOne) SaveX(ctx context.Context) *Threat
- func (tuo *ThreatUpdateOne) Select(field string, fields ...string) *ThreatUpdateOne
- func (tuo *ThreatUpdateOne) SetCtime(i int64) *ThreatUpdateOne
- func (tuo *ThreatUpdateOne) SetDomainCount(i int) *ThreatUpdateOne
- func (tuo *ThreatUpdateOne) SetIP(s string) *ThreatUpdateOne
- func (tuo *ThreatUpdateOne) SetItelCount(i int) *ThreatUpdateOne
- func (tuo *ThreatUpdateOne) SetJudge(i int) *ThreatUpdateOne
- func (tuo *ThreatUpdateOne) SetPoc(b bool) *ThreatUpdateOne
- func (tuo *ThreatUpdateOne) SetSource(i int) *ThreatUpdateOne
- func (tuo *ThreatUpdateOne) SetTagCount(i int) *ThreatUpdateOne
- func (tuo *ThreatUpdateOne) SetThreatIDInfo(s string) *ThreatUpdateOne
- type Threats
- type Tx
- type ValidationError
- type Value
Constants ¶
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 ¶
IsConstraintError returns a boolean indicating whether the error is a constraint failure.
func IsNotFound ¶
IsNotFound returns a boolean indicating whether the error is a not found error.
func IsNotLoaded ¶
IsNotLoaded returns a boolean indicating whether the error is a not loaded error.
func IsNotSingular ¶
IsNotSingular returns a boolean indicating whether the error is a not singular error.
func IsValidationError ¶
IsValidationError returns a boolean indicating whether the error is a validation error.
func NewContext ¶
NewContext returns a new context with the given Client attached.
Types ¶
type AggregateFunc ¶
AggregateFunc applies an aggregation step on the group-by traversal/selector.
func As ¶
func As(fn AggregateFunc, end string) AggregateFunc
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 ¶
FromContext returns a Client stored inside a context, or nil if there isn't one.
func Open ¶
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) Debug ¶
Debug returns a new debug-client. It's used to get verbose logging on specific operations.
client.Debug(). Threat. Query(). Count(ctx)
type CommitFunc ¶
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.
type CommitHook ¶
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 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 MutateFunc ¶
type MutateFunc = ent.MutateFunc
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 RollbackFunc ¶
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.
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 ¶
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) Unwrap ¶
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) GetX ¶
func (c *ThreatClient) GetX(ctx context.Context, id int) *Threat
GetX is like Get, but panics if an error occurs.
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.
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 ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*ThreatGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*ThreatGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*ThreatGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*ThreatGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*ThreatGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
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) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
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 ¶
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) 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) 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 ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*ThreatSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*ThreatSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*ThreatSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*ThreatSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*ThreatSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
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) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
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 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 ¶
TxFromContext returns a Tx stored inside a context, or nil if there isn't one.
func (*Tx) OnRollback ¶
func (tx *Tx) OnRollback(f RollbackHook)
OnRollback adds a hook to call on rollback.
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.