Versions in this module Expand all Collapse all v1 v1.0.2 Nov 20, 2024 Changes in this version + const OpCreate + const OpDelete + const OpDeleteOne + const OpUpdate + const OpUpdateOne + const TypeCasbinRule + var ErrTxStarted = errors.New("ent: cannot start a transaction within a transaction") + func Asc(fields ...string) func(*sql.Selector) + func Desc(fields ...string) func(*sql.Selector) + 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 func(*sql.Selector) string + func As(fn AggregateFunc, end string) AggregateFunc + func Count() AggregateFunc + func Max(field string) AggregateFunc + func Mean(field string) AggregateFunc + func Min(field string) AggregateFunc + func Sum(field string) AggregateFunc + type CasbinRule struct + ID int + Ptype string + V0 string + V1 string + V2 string + V3 string + V4 string + V5 string + func (cr *CasbinRule) String() string + func (cr *CasbinRule) Unwrap() *CasbinRule + func (cr *CasbinRule) Update() *CasbinRuleUpdateOne + func (cr *CasbinRule) Value(name string) (ent.Value, error) + type CasbinRuleClient struct + func NewCasbinRuleClient(c config) *CasbinRuleClient + func (c *CasbinRuleClient) Create() *CasbinRuleCreate + func (c *CasbinRuleClient) CreateBulk(builders ...*CasbinRuleCreate) *CasbinRuleCreateBulk + func (c *CasbinRuleClient) Delete() *CasbinRuleDelete + func (c *CasbinRuleClient) DeleteOne(cr *CasbinRule) *CasbinRuleDeleteOne + func (c *CasbinRuleClient) DeleteOneID(id int) *CasbinRuleDeleteOne + func (c *CasbinRuleClient) Get(ctx context.Context, id int) (*CasbinRule, error) + func (c *CasbinRuleClient) GetX(ctx context.Context, id int) *CasbinRule + func (c *CasbinRuleClient) Hooks() []Hook + func (c *CasbinRuleClient) Intercept(interceptors ...Interceptor) + func (c *CasbinRuleClient) Interceptors() []Interceptor + func (c *CasbinRuleClient) MapCreateBulk(slice any, setFunc func(*CasbinRuleCreate, int)) *CasbinRuleCreateBulk + func (c *CasbinRuleClient) Query() *CasbinRuleQuery + func (c *CasbinRuleClient) Update() *CasbinRuleUpdate + func (c *CasbinRuleClient) UpdateOne(cr *CasbinRule) *CasbinRuleUpdateOne + func (c *CasbinRuleClient) UpdateOneID(id int) *CasbinRuleUpdateOne + func (c *CasbinRuleClient) Use(hooks ...Hook) + type CasbinRuleCreate struct + func (crc *CasbinRuleCreate) Exec(ctx context.Context) error + func (crc *CasbinRuleCreate) ExecX(ctx context.Context) + func (crc *CasbinRuleCreate) Mutation() *CasbinRuleMutation + func (crc *CasbinRuleCreate) Save(ctx context.Context) (*CasbinRule, error) + func (crc *CasbinRuleCreate) SaveX(ctx context.Context) *CasbinRule + func (crc *CasbinRuleCreate) SetNillablePtype(s *string) *CasbinRuleCreate + func (crc *CasbinRuleCreate) SetNillableV0(s *string) *CasbinRuleCreate + func (crc *CasbinRuleCreate) SetNillableV1(s *string) *CasbinRuleCreate + func (crc *CasbinRuleCreate) SetNillableV2(s *string) *CasbinRuleCreate + func (crc *CasbinRuleCreate) SetNillableV3(s *string) *CasbinRuleCreate + func (crc *CasbinRuleCreate) SetNillableV4(s *string) *CasbinRuleCreate + func (crc *CasbinRuleCreate) SetNillableV5(s *string) *CasbinRuleCreate + func (crc *CasbinRuleCreate) SetPtype(s string) *CasbinRuleCreate + func (crc *CasbinRuleCreate) SetV0(s string) *CasbinRuleCreate + func (crc *CasbinRuleCreate) SetV1(s string) *CasbinRuleCreate + func (crc *CasbinRuleCreate) SetV2(s string) *CasbinRuleCreate + func (crc *CasbinRuleCreate) SetV3(s string) *CasbinRuleCreate + func (crc *CasbinRuleCreate) SetV4(s string) *CasbinRuleCreate + func (crc *CasbinRuleCreate) SetV5(s string) *CasbinRuleCreate + type CasbinRuleCreateBulk struct + func (crcb *CasbinRuleCreateBulk) Exec(ctx context.Context) error + func (crcb *CasbinRuleCreateBulk) ExecX(ctx context.Context) + func (crcb *CasbinRuleCreateBulk) Save(ctx context.Context) ([]*CasbinRule, error) + func (crcb *CasbinRuleCreateBulk) SaveX(ctx context.Context) []*CasbinRule + type CasbinRuleDelete struct + func (crd *CasbinRuleDelete) Exec(ctx context.Context) (int, error) + func (crd *CasbinRuleDelete) ExecX(ctx context.Context) int + func (crd *CasbinRuleDelete) Where(ps ...predicate.CasbinRule) *CasbinRuleDelete + type CasbinRuleDeleteOne struct + func (crdo *CasbinRuleDeleteOne) Exec(ctx context.Context) error + func (crdo *CasbinRuleDeleteOne) ExecX(ctx context.Context) + func (crdo *CasbinRuleDeleteOne) Where(ps ...predicate.CasbinRule) *CasbinRuleDeleteOne + type CasbinRuleGroupBy struct + func (crgb *CasbinRuleGroupBy) Aggregate(fns ...AggregateFunc) *CasbinRuleGroupBy + func (crgb *CasbinRuleGroupBy) Scan(ctx context.Context, v any) error + func (s *CasbinRuleGroupBy) Bool(ctx context.Context) (_ bool, err error) + func (s *CasbinRuleGroupBy) BoolX(ctx context.Context) bool + func (s *CasbinRuleGroupBy) Bools(ctx context.Context) ([]bool, error) + func (s *CasbinRuleGroupBy) BoolsX(ctx context.Context) []bool + func (s *CasbinRuleGroupBy) Float64(ctx context.Context) (_ float64, err error) + func (s *CasbinRuleGroupBy) Float64X(ctx context.Context) float64 + func (s *CasbinRuleGroupBy) Float64s(ctx context.Context) ([]float64, error) + func (s *CasbinRuleGroupBy) Float64sX(ctx context.Context) []float64 + func (s *CasbinRuleGroupBy) Int(ctx context.Context) (_ int, err error) + func (s *CasbinRuleGroupBy) IntX(ctx context.Context) int + func (s *CasbinRuleGroupBy) Ints(ctx context.Context) ([]int, error) + func (s *CasbinRuleGroupBy) IntsX(ctx context.Context) []int + func (s *CasbinRuleGroupBy) ScanX(ctx context.Context, v any) + func (s *CasbinRuleGroupBy) String(ctx context.Context) (_ string, err error) + func (s *CasbinRuleGroupBy) StringX(ctx context.Context) string + func (s *CasbinRuleGroupBy) Strings(ctx context.Context) ([]string, error) + func (s *CasbinRuleGroupBy) StringsX(ctx context.Context) []string + type CasbinRuleMutation struct + func (m *CasbinRuleMutation) AddField(name string, value ent.Value) error + func (m *CasbinRuleMutation) AddedEdges() []string + func (m *CasbinRuleMutation) AddedField(name string) (ent.Value, bool) + func (m *CasbinRuleMutation) AddedFields() []string + func (m *CasbinRuleMutation) AddedIDs(name string) []ent.Value + func (m *CasbinRuleMutation) ClearEdge(name string) error + func (m *CasbinRuleMutation) ClearField(name string) error + func (m *CasbinRuleMutation) ClearedEdges() []string + func (m *CasbinRuleMutation) ClearedFields() []string + func (m *CasbinRuleMutation) EdgeCleared(name string) bool + func (m *CasbinRuleMutation) Field(name string) (ent.Value, bool) + func (m *CasbinRuleMutation) FieldCleared(name string) bool + func (m *CasbinRuleMutation) Fields() []string + func (m *CasbinRuleMutation) ID() (id int, exists bool) + func (m *CasbinRuleMutation) IDs(ctx context.Context) ([]int, error) + func (m *CasbinRuleMutation) OldField(ctx context.Context, name string) (ent.Value, error) + func (m *CasbinRuleMutation) OldPtype(ctx context.Context) (v string, err error) + func (m *CasbinRuleMutation) OldV0(ctx context.Context) (v string, err error) + func (m *CasbinRuleMutation) OldV1(ctx context.Context) (v string, err error) + func (m *CasbinRuleMutation) OldV2(ctx context.Context) (v string, err error) + func (m *CasbinRuleMutation) OldV3(ctx context.Context) (v string, err error) + func (m *CasbinRuleMutation) OldV4(ctx context.Context) (v string, err error) + func (m *CasbinRuleMutation) OldV5(ctx context.Context) (v string, err error) + func (m *CasbinRuleMutation) Op() Op + func (m *CasbinRuleMutation) Ptype() (r string, exists bool) + func (m *CasbinRuleMutation) RemovedEdges() []string + func (m *CasbinRuleMutation) RemovedIDs(name string) []ent.Value + func (m *CasbinRuleMutation) ResetEdge(name string) error + func (m *CasbinRuleMutation) ResetField(name string) error + func (m *CasbinRuleMutation) ResetPtype() + func (m *CasbinRuleMutation) ResetV0() + func (m *CasbinRuleMutation) ResetV1() + func (m *CasbinRuleMutation) ResetV2() + func (m *CasbinRuleMutation) ResetV3() + func (m *CasbinRuleMutation) ResetV4() + func (m *CasbinRuleMutation) ResetV5() + func (m *CasbinRuleMutation) SetField(name string, value ent.Value) error + func (m *CasbinRuleMutation) SetOp(op Op) + func (m *CasbinRuleMutation) SetPtype(s string) + func (m *CasbinRuleMutation) SetV0(s string) + func (m *CasbinRuleMutation) SetV1(s string) + func (m *CasbinRuleMutation) SetV2(s string) + func (m *CasbinRuleMutation) SetV3(s string) + func (m *CasbinRuleMutation) SetV4(s string) + func (m *CasbinRuleMutation) SetV5(s string) + func (m *CasbinRuleMutation) Type() string + func (m *CasbinRuleMutation) V0() (r string, exists bool) + func (m *CasbinRuleMutation) V1() (r string, exists bool) + func (m *CasbinRuleMutation) V2() (r string, exists bool) + func (m *CasbinRuleMutation) V3() (r string, exists bool) + func (m *CasbinRuleMutation) V4() (r string, exists bool) + func (m *CasbinRuleMutation) V5() (r string, exists bool) + func (m *CasbinRuleMutation) Where(ps ...predicate.CasbinRule) + func (m *CasbinRuleMutation) WhereP(ps ...func(*sql.Selector)) + func (m CasbinRuleMutation) Client() *Client + func (m CasbinRuleMutation) Tx() (*Tx, error) + type CasbinRuleQuery struct + func (crq *CasbinRuleQuery) Aggregate(fns ...AggregateFunc) *CasbinRuleSelect + func (crq *CasbinRuleQuery) All(ctx context.Context) ([]*CasbinRule, error) + func (crq *CasbinRuleQuery) AllX(ctx context.Context) []*CasbinRule + func (crq *CasbinRuleQuery) Clone() *CasbinRuleQuery + func (crq *CasbinRuleQuery) Count(ctx context.Context) (int, error) + func (crq *CasbinRuleQuery) CountX(ctx context.Context) int + func (crq *CasbinRuleQuery) Exist(ctx context.Context) (bool, error) + func (crq *CasbinRuleQuery) ExistX(ctx context.Context) bool + func (crq *CasbinRuleQuery) First(ctx context.Context) (*CasbinRule, error) + func (crq *CasbinRuleQuery) FirstID(ctx context.Context) (id int, err error) + func (crq *CasbinRuleQuery) FirstIDX(ctx context.Context) int + func (crq *CasbinRuleQuery) FirstX(ctx context.Context) *CasbinRule + func (crq *CasbinRuleQuery) GroupBy(field string, fields ...string) *CasbinRuleGroupBy + func (crq *CasbinRuleQuery) IDs(ctx context.Context) (ids []int, err error) + func (crq *CasbinRuleQuery) IDsX(ctx context.Context) []int + func (crq *CasbinRuleQuery) Limit(limit int) *CasbinRuleQuery + func (crq *CasbinRuleQuery) Offset(offset int) *CasbinRuleQuery + func (crq *CasbinRuleQuery) Only(ctx context.Context) (*CasbinRule, error) + func (crq *CasbinRuleQuery) OnlyID(ctx context.Context) (id int, err error) + func (crq *CasbinRuleQuery) OnlyIDX(ctx context.Context) int + func (crq *CasbinRuleQuery) OnlyX(ctx context.Context) *CasbinRule + func (crq *CasbinRuleQuery) Order(o ...casbinrule.OrderOption) *CasbinRuleQuery + func (crq *CasbinRuleQuery) Select(fields ...string) *CasbinRuleSelect + func (crq *CasbinRuleQuery) Unique(unique bool) *CasbinRuleQuery + func (crq *CasbinRuleQuery) Where(ps ...predicate.CasbinRule) *CasbinRuleQuery + type CasbinRuleSelect struct + func (crs *CasbinRuleSelect) Aggregate(fns ...AggregateFunc) *CasbinRuleSelect + func (crs *CasbinRuleSelect) Scan(ctx context.Context, v any) error + func (s *CasbinRuleSelect) Bool(ctx context.Context) (_ bool, err error) + func (s *CasbinRuleSelect) BoolX(ctx context.Context) bool + func (s *CasbinRuleSelect) Bools(ctx context.Context) ([]bool, error) + func (s *CasbinRuleSelect) BoolsX(ctx context.Context) []bool + func (s *CasbinRuleSelect) Float64(ctx context.Context) (_ float64, err error) + func (s *CasbinRuleSelect) Float64X(ctx context.Context) float64 + func (s *CasbinRuleSelect) Float64s(ctx context.Context) ([]float64, error) + func (s *CasbinRuleSelect) Float64sX(ctx context.Context) []float64 + func (s *CasbinRuleSelect) Int(ctx context.Context) (_ int, err error) + func (s *CasbinRuleSelect) IntX(ctx context.Context) int + func (s *CasbinRuleSelect) Ints(ctx context.Context) ([]int, error) + func (s *CasbinRuleSelect) IntsX(ctx context.Context) []int + func (s *CasbinRuleSelect) ScanX(ctx context.Context, v any) + func (s *CasbinRuleSelect) String(ctx context.Context) (_ string, err error) + func (s *CasbinRuleSelect) StringX(ctx context.Context) string + func (s *CasbinRuleSelect) Strings(ctx context.Context) ([]string, error) + func (s *CasbinRuleSelect) StringsX(ctx context.Context) []string + type CasbinRuleUpdate struct + func (cru *CasbinRuleUpdate) Exec(ctx context.Context) error + func (cru *CasbinRuleUpdate) ExecX(ctx context.Context) + func (cru *CasbinRuleUpdate) Mutation() *CasbinRuleMutation + func (cru *CasbinRuleUpdate) Save(ctx context.Context) (int, error) + func (cru *CasbinRuleUpdate) SaveX(ctx context.Context) int + func (cru *CasbinRuleUpdate) SetNillablePtype(s *string) *CasbinRuleUpdate + func (cru *CasbinRuleUpdate) SetNillableV0(s *string) *CasbinRuleUpdate + func (cru *CasbinRuleUpdate) SetNillableV1(s *string) *CasbinRuleUpdate + func (cru *CasbinRuleUpdate) SetNillableV2(s *string) *CasbinRuleUpdate + func (cru *CasbinRuleUpdate) SetNillableV3(s *string) *CasbinRuleUpdate + func (cru *CasbinRuleUpdate) SetNillableV4(s *string) *CasbinRuleUpdate + func (cru *CasbinRuleUpdate) SetNillableV5(s *string) *CasbinRuleUpdate + func (cru *CasbinRuleUpdate) SetPtype(s string) *CasbinRuleUpdate + func (cru *CasbinRuleUpdate) SetV0(s string) *CasbinRuleUpdate + func (cru *CasbinRuleUpdate) SetV1(s string) *CasbinRuleUpdate + func (cru *CasbinRuleUpdate) SetV2(s string) *CasbinRuleUpdate + func (cru *CasbinRuleUpdate) SetV3(s string) *CasbinRuleUpdate + func (cru *CasbinRuleUpdate) SetV4(s string) *CasbinRuleUpdate + func (cru *CasbinRuleUpdate) SetV5(s string) *CasbinRuleUpdate + func (cru *CasbinRuleUpdate) Where(ps ...predicate.CasbinRule) *CasbinRuleUpdate + type CasbinRuleUpdateOne struct + func (cruo *CasbinRuleUpdateOne) Exec(ctx context.Context) error + func (cruo *CasbinRuleUpdateOne) ExecX(ctx context.Context) + func (cruo *CasbinRuleUpdateOne) Mutation() *CasbinRuleMutation + func (cruo *CasbinRuleUpdateOne) Save(ctx context.Context) (*CasbinRule, error) + func (cruo *CasbinRuleUpdateOne) SaveX(ctx context.Context) *CasbinRule + func (cruo *CasbinRuleUpdateOne) Select(field string, fields ...string) *CasbinRuleUpdateOne + func (cruo *CasbinRuleUpdateOne) SetNillablePtype(s *string) *CasbinRuleUpdateOne + func (cruo *CasbinRuleUpdateOne) SetNillableV0(s *string) *CasbinRuleUpdateOne + func (cruo *CasbinRuleUpdateOne) SetNillableV1(s *string) *CasbinRuleUpdateOne + func (cruo *CasbinRuleUpdateOne) SetNillableV2(s *string) *CasbinRuleUpdateOne + func (cruo *CasbinRuleUpdateOne) SetNillableV3(s *string) *CasbinRuleUpdateOne + func (cruo *CasbinRuleUpdateOne) SetNillableV4(s *string) *CasbinRuleUpdateOne + func (cruo *CasbinRuleUpdateOne) SetNillableV5(s *string) *CasbinRuleUpdateOne + func (cruo *CasbinRuleUpdateOne) SetPtype(s string) *CasbinRuleUpdateOne + func (cruo *CasbinRuleUpdateOne) SetV0(s string) *CasbinRuleUpdateOne + func (cruo *CasbinRuleUpdateOne) SetV1(s string) *CasbinRuleUpdateOne + func (cruo *CasbinRuleUpdateOne) SetV2(s string) *CasbinRuleUpdateOne + func (cruo *CasbinRuleUpdateOne) SetV3(s string) *CasbinRuleUpdateOne + func (cruo *CasbinRuleUpdateOne) SetV4(s string) *CasbinRuleUpdateOne + func (cruo *CasbinRuleUpdateOne) SetV5(s string) *CasbinRuleUpdateOne + func (cruo *CasbinRuleUpdateOne) Where(ps ...predicate.CasbinRule) *CasbinRuleUpdateOne + type CasbinRules []*CasbinRule + type Client struct + CasbinRule *CasbinRuleClient + Schema *migrate.Schema + func FromContext(ctx context.Context) *Client + func NewClient(opts ...Option) *Client + func Open(driverName, dataSourceName string, options ...Option) (*Client, error) + func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) + func (c *Client) Close() error + func (c *Client) Debug() *Client + func (c *Client) Intercept(interceptors ...Interceptor) + func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) + func (c *Client) Tx(ctx context.Context) (*Tx, error) + func (c *Client) Use(hooks ...Hook) + type CommitFunc func(context.Context, *Tx) error + func (f CommitFunc) Commit(ctx context.Context, tx *Tx) error + type CommitHook func(Committer) Committer + type Committer interface + Commit func(context.Context, *Tx) error + type ConstraintError struct + func (e *ConstraintError) Unwrap() error + func (e ConstraintError) Error() string + type Hook = ent.Hook + type InterceptFunc = ent.InterceptFunc + type Interceptor = ent.Interceptor + type MutateFunc = ent.MutateFunc + type Mutation = ent.Mutation + type Mutator = ent.Mutator + type NotFoundError struct + func (e *NotFoundError) Error() string + type NotLoadedError struct + func (e *NotLoadedError) Error() string + type NotSingularError struct + func (e *NotSingularError) Error() string + type Op = ent.Op + type Option func(*config) + func Debug() Option + func Driver(driver dialect.Driver) Option + func Log(fn func(...any)) Option + type OrderFunc func(*sql.Selector) + type Policy = ent.Policy + type Querier = ent.Querier + type QuerierFunc = ent.QuerierFunc + type Query = ent.Query + type QueryContext = ent.QueryContext + type RollbackFunc func(context.Context, *Tx) error + func (f RollbackFunc) Rollback(ctx context.Context, tx *Tx) error + type RollbackHook func(Rollbacker) Rollbacker + type Rollbacker interface + Rollback func(context.Context, *Tx) error + type TraverseFunc = ent.TraverseFunc + type Traverser = ent.Traverser + type Tx struct + CasbinRule *CasbinRuleClient + func TxFromContext(ctx context.Context) *Tx + func (tx *Tx) Client() *Client + func (tx *Tx) Commit() error + func (tx *Tx) OnCommit(f CommitHook) + func (tx *Tx) OnRollback(f RollbackHook) + func (tx *Tx) Rollback() error + type ValidationError struct + Name string + func (e *ValidationError) Error() string + func (e *ValidationError) Unwrap() error + type Value = ent.Value