ent

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: MIT Imports: 7 Imported by: 2

README

Ent adapter

  • Enable EntQL Filtering and Privacy Layer features Modify your ent/generate.go

    go generate ... --feature intercept,schema/snapshot ...
    
  • Embed mixin into your schema

    import (
    	sent "github.com/go-saas/saas/ent"
    )
    ...
    // Post holds the schema definition for the Post entity.
    type Post struct {
        ent.Schema
    }
    
    func (Post) Mixin() []ent.Mixin {
        return []ent.Mixin{
            sent.HasTenant{},
        }
    }
    

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func If added in v0.6.2

func If(hk entgo.Hook, cond Condition) entgo.Hook

If executes the given hook under condition.

hook.If(ComputeAverage, And(HasFields(...), HasAddedFields(...)))

func On added in v0.6.2

func On(hk entgo.Hook, op entgo.Op) entgo.Hook

Types

type Condition added in v0.6.2

type Condition func(context.Context, entgo.Mutation) bool

Condition is a hook condition function.

func HasOp added in v0.6.2

func HasOp(op entgo.Op) Condition

HasOp is a condition testing mutation operation.

type HasTenant added in v0.6.2

type HasTenant struct {
	entgo.Schema
}

func (HasTenant) Fields added in v0.6.2

func (HasTenant) Fields() []entgo.Field

func (HasTenant) Hooks added in v0.6.2

func (h HasTenant) Hooks() []entgo.Hook

func (HasTenant) Interceptors added in v0.6.2

func (h HasTenant) Interceptors() []entgo.Interceptor

func (HasTenant) P added in v0.6.2

func (h HasTenant) P(t saas.TenantInfo, w interface{ WhereP(...func(*sql.Selector)) })

type WhereP added in v0.6.2

type WhereP interface{ WhereP(...func(*sql.Selector)) }

Jump to

Keyboard shortcuts

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