1055 lines
35 KiB
Go
1055 lines
35 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
"log"
|
|
"reflect"
|
|
|
|
"home-vue-go/internal/ent/migrate"
|
|
|
|
"home-vue-go/internal/ent/contact"
|
|
"home-vue-go/internal/ent/loginhistory"
|
|
"home-vue-go/internal/ent/site"
|
|
"home-vue-go/internal/ent/siteconfig"
|
|
"home-vue-go/internal/ent/user"
|
|
"home-vue-go/internal/ent/visit"
|
|
|
|
"entgo.io/ent"
|
|
"entgo.io/ent/dialect"
|
|
"entgo.io/ent/dialect/sql"
|
|
)
|
|
|
|
// Client is the client that holds all ent builders.
|
|
type Client struct {
|
|
config
|
|
// Schema is the client for creating, migrating and dropping schema.
|
|
Schema *migrate.Schema
|
|
// Contact is the client for interacting with the Contact builders.
|
|
Contact *ContactClient
|
|
// LoginHistory is the client for interacting with the LoginHistory builders.
|
|
LoginHistory *LoginHistoryClient
|
|
// Site is the client for interacting with the Site builders.
|
|
Site *SiteClient
|
|
// SiteConfig is the client for interacting with the SiteConfig builders.
|
|
SiteConfig *SiteConfigClient
|
|
// User is the client for interacting with the User builders.
|
|
User *UserClient
|
|
// Visit is the client for interacting with the Visit builders.
|
|
Visit *VisitClient
|
|
}
|
|
|
|
// NewClient creates a new client configured with the given options.
|
|
func NewClient(opts ...Option) *Client {
|
|
client := &Client{config: newConfig(opts...)}
|
|
client.init()
|
|
return client
|
|
}
|
|
|
|
func (c *Client) init() {
|
|
c.Schema = migrate.NewSchema(c.driver)
|
|
c.Contact = NewContactClient(c.config)
|
|
c.LoginHistory = NewLoginHistoryClient(c.config)
|
|
c.Site = NewSiteClient(c.config)
|
|
c.SiteConfig = NewSiteConfigClient(c.config)
|
|
c.User = NewUserClient(c.config)
|
|
c.Visit = NewVisitClient(c.config)
|
|
}
|
|
|
|
type (
|
|
// config is the configuration for the client and its builder.
|
|
config struct {
|
|
// driver used for executing database requests.
|
|
driver dialect.Driver
|
|
// debug enable a debug logging.
|
|
debug bool
|
|
// log used for logging on debug mode.
|
|
log func(...any)
|
|
// hooks to execute on mutations.
|
|
hooks *hooks
|
|
// interceptors to execute on queries.
|
|
inters *inters
|
|
}
|
|
// Option function to configure the client.
|
|
Option func(*config)
|
|
)
|
|
|
|
// newConfig creates a new config for the client.
|
|
func newConfig(opts ...Option) config {
|
|
cfg := config{log: log.Println, hooks: &hooks{}, inters: &inters{}}
|
|
cfg.options(opts...)
|
|
return cfg
|
|
}
|
|
|
|
// options applies the options on the config object.
|
|
func (c *config) options(opts ...Option) {
|
|
for _, opt := range opts {
|
|
opt(c)
|
|
}
|
|
if c.debug {
|
|
c.driver = dialect.Debug(c.driver, c.log)
|
|
}
|
|
}
|
|
|
|
// Debug enables debug logging on the ent.Driver.
|
|
func Debug() Option {
|
|
return func(c *config) {
|
|
c.debug = true
|
|
}
|
|
}
|
|
|
|
// Log sets the logging function for debug mode.
|
|
func Log(fn func(...any)) Option {
|
|
return func(c *config) {
|
|
c.log = fn
|
|
}
|
|
}
|
|
|
|
// Driver configures the client driver.
|
|
func Driver(driver dialect.Driver) Option {
|
|
return func(c *config) {
|
|
c.driver = driver
|
|
}
|
|
}
|
|
|
|
// 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 Open(driverName, dataSourceName string, options ...Option) (*Client, error) {
|
|
switch driverName {
|
|
case dialect.MySQL, dialect.Postgres, dialect.SQLite:
|
|
drv, err := sql.Open(driverName, dataSourceName)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return NewClient(append(options, Driver(drv))...), nil
|
|
default:
|
|
return nil, fmt.Errorf("unsupported driver: %q", driverName)
|
|
}
|
|
}
|
|
|
|
// ErrTxStarted is returned when trying to start a new transaction from a transactional client.
|
|
var ErrTxStarted = errors.New("ent: cannot start a transaction within a transaction")
|
|
|
|
// Tx returns a new transactional client. The provided context
|
|
// is used until the transaction is committed or rolled back.
|
|
func (c *Client) Tx(ctx context.Context) (*Tx, error) {
|
|
if _, ok := c.driver.(*txDriver); ok {
|
|
return nil, ErrTxStarted
|
|
}
|
|
tx, err := newTx(ctx, c.driver)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("ent: starting a transaction: %w", err)
|
|
}
|
|
cfg := c.config
|
|
cfg.driver = tx
|
|
return &Tx{
|
|
ctx: ctx,
|
|
config: cfg,
|
|
Contact: NewContactClient(cfg),
|
|
LoginHistory: NewLoginHistoryClient(cfg),
|
|
Site: NewSiteClient(cfg),
|
|
SiteConfig: NewSiteConfigClient(cfg),
|
|
User: NewUserClient(cfg),
|
|
Visit: NewVisitClient(cfg),
|
|
}, nil
|
|
}
|
|
|
|
// BeginTx returns a transactional client with specified options.
|
|
func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {
|
|
if _, ok := c.driver.(*txDriver); ok {
|
|
return nil, errors.New("ent: cannot start a transaction within a transaction")
|
|
}
|
|
tx, err := c.driver.(interface {
|
|
BeginTx(context.Context, *sql.TxOptions) (dialect.Tx, error)
|
|
}).BeginTx(ctx, opts)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("ent: starting a transaction: %w", err)
|
|
}
|
|
cfg := c.config
|
|
cfg.driver = &txDriver{tx: tx, drv: c.driver}
|
|
return &Tx{
|
|
ctx: ctx,
|
|
config: cfg,
|
|
Contact: NewContactClient(cfg),
|
|
LoginHistory: NewLoginHistoryClient(cfg),
|
|
Site: NewSiteClient(cfg),
|
|
SiteConfig: NewSiteConfigClient(cfg),
|
|
User: NewUserClient(cfg),
|
|
Visit: NewVisitClient(cfg),
|
|
}, nil
|
|
}
|
|
|
|
// Debug returns a new debug-client. It's used to get verbose logging on specific operations.
|
|
//
|
|
// client.Debug().
|
|
// Contact.
|
|
// Query().
|
|
// Count(ctx)
|
|
func (c *Client) Debug() *Client {
|
|
if c.debug {
|
|
return c
|
|
}
|
|
cfg := c.config
|
|
cfg.driver = dialect.Debug(c.driver, c.log)
|
|
client := &Client{config: cfg}
|
|
client.init()
|
|
return client
|
|
}
|
|
|
|
// Close closes the database connection and prevents new queries from starting.
|
|
func (c *Client) Close() error {
|
|
return c.driver.Close()
|
|
}
|
|
|
|
// Use adds the mutation hooks to all the entity clients.
|
|
// In order to add hooks to a specific client, call: `client.Node.Use(...)`.
|
|
func (c *Client) Use(hooks ...Hook) {
|
|
for _, n := range []interface{ Use(...Hook) }{
|
|
c.Contact, c.LoginHistory, c.Site, c.SiteConfig, c.User, c.Visit,
|
|
} {
|
|
n.Use(hooks...)
|
|
}
|
|
}
|
|
|
|
// Intercept adds the query interceptors to all the entity clients.
|
|
// In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`.
|
|
func (c *Client) Intercept(interceptors ...Interceptor) {
|
|
for _, n := range []interface{ Intercept(...Interceptor) }{
|
|
c.Contact, c.LoginHistory, c.Site, c.SiteConfig, c.User, c.Visit,
|
|
} {
|
|
n.Intercept(interceptors...)
|
|
}
|
|
}
|
|
|
|
// Mutate implements the ent.Mutator interface.
|
|
func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) {
|
|
switch m := m.(type) {
|
|
case *ContactMutation:
|
|
return c.Contact.mutate(ctx, m)
|
|
case *LoginHistoryMutation:
|
|
return c.LoginHistory.mutate(ctx, m)
|
|
case *SiteMutation:
|
|
return c.Site.mutate(ctx, m)
|
|
case *SiteConfigMutation:
|
|
return c.SiteConfig.mutate(ctx, m)
|
|
case *UserMutation:
|
|
return c.User.mutate(ctx, m)
|
|
case *VisitMutation:
|
|
return c.Visit.mutate(ctx, m)
|
|
default:
|
|
return nil, fmt.Errorf("ent: unknown mutation type %T", m)
|
|
}
|
|
}
|
|
|
|
// ContactClient is a client for the Contact schema.
|
|
type ContactClient struct {
|
|
config
|
|
}
|
|
|
|
// NewContactClient returns a client for the Contact from the given config.
|
|
func NewContactClient(c config) *ContactClient {
|
|
return &ContactClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `contact.Hooks(f(g(h())))`.
|
|
func (c *ContactClient) Use(hooks ...Hook) {
|
|
c.hooks.Contact = append(c.hooks.Contact, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `contact.Intercept(f(g(h())))`.
|
|
func (c *ContactClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.Contact = append(c.inters.Contact, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a Contact entity.
|
|
func (c *ContactClient) Create() *ContactCreate {
|
|
mutation := newContactMutation(c.config, OpCreate)
|
|
return &ContactCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of Contact entities.
|
|
func (c *ContactClient) CreateBulk(builders ...*ContactCreate) *ContactCreateBulk {
|
|
return &ContactCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
|
|
// a builder and applies setFunc on it.
|
|
func (c *ContactClient) MapCreateBulk(slice any, setFunc func(*ContactCreate, int)) *ContactCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &ContactCreateBulk{err: fmt.Errorf("calling to ContactClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*ContactCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &ContactCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for Contact.
|
|
func (c *ContactClient) Update() *ContactUpdate {
|
|
mutation := newContactMutation(c.config, OpUpdate)
|
|
return &ContactUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *ContactClient) UpdateOne(_m *Contact) *ContactUpdateOne {
|
|
mutation := newContactMutation(c.config, OpUpdateOne, withContact(_m))
|
|
return &ContactUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *ContactClient) UpdateOneID(id int) *ContactUpdateOne {
|
|
mutation := newContactMutation(c.config, OpUpdateOne, withContactID(id))
|
|
return &ContactUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for Contact.
|
|
func (c *ContactClient) Delete() *ContactDelete {
|
|
mutation := newContactMutation(c.config, OpDelete)
|
|
return &ContactDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *ContactClient) DeleteOne(_m *Contact) *ContactDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *ContactClient) DeleteOneID(id int) *ContactDeleteOne {
|
|
builder := c.Delete().Where(contact.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &ContactDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for Contact.
|
|
func (c *ContactClient) Query() *ContactQuery {
|
|
return &ContactQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeContact},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a Contact entity by its id.
|
|
func (c *ContactClient) Get(ctx context.Context, id int) (*Contact, error) {
|
|
return c.Query().Where(contact.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *ContactClient) GetX(ctx context.Context, id int) *Contact {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *ContactClient) Hooks() []Hook {
|
|
return c.hooks.Contact
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *ContactClient) Interceptors() []Interceptor {
|
|
return c.inters.Contact
|
|
}
|
|
|
|
func (c *ContactClient) mutate(ctx context.Context, m *ContactMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&ContactCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&ContactUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&ContactUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&ContactDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("ent: unknown Contact mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// LoginHistoryClient is a client for the LoginHistory schema.
|
|
type LoginHistoryClient struct {
|
|
config
|
|
}
|
|
|
|
// NewLoginHistoryClient returns a client for the LoginHistory from the given config.
|
|
func NewLoginHistoryClient(c config) *LoginHistoryClient {
|
|
return &LoginHistoryClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `loginhistory.Hooks(f(g(h())))`.
|
|
func (c *LoginHistoryClient) Use(hooks ...Hook) {
|
|
c.hooks.LoginHistory = append(c.hooks.LoginHistory, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `loginhistory.Intercept(f(g(h())))`.
|
|
func (c *LoginHistoryClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.LoginHistory = append(c.inters.LoginHistory, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a LoginHistory entity.
|
|
func (c *LoginHistoryClient) Create() *LoginHistoryCreate {
|
|
mutation := newLoginHistoryMutation(c.config, OpCreate)
|
|
return &LoginHistoryCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of LoginHistory entities.
|
|
func (c *LoginHistoryClient) CreateBulk(builders ...*LoginHistoryCreate) *LoginHistoryCreateBulk {
|
|
return &LoginHistoryCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
|
|
// a builder and applies setFunc on it.
|
|
func (c *LoginHistoryClient) MapCreateBulk(slice any, setFunc func(*LoginHistoryCreate, int)) *LoginHistoryCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &LoginHistoryCreateBulk{err: fmt.Errorf("calling to LoginHistoryClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*LoginHistoryCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &LoginHistoryCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for LoginHistory.
|
|
func (c *LoginHistoryClient) Update() *LoginHistoryUpdate {
|
|
mutation := newLoginHistoryMutation(c.config, OpUpdate)
|
|
return &LoginHistoryUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *LoginHistoryClient) UpdateOne(_m *LoginHistory) *LoginHistoryUpdateOne {
|
|
mutation := newLoginHistoryMutation(c.config, OpUpdateOne, withLoginHistory(_m))
|
|
return &LoginHistoryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *LoginHistoryClient) UpdateOneID(id int) *LoginHistoryUpdateOne {
|
|
mutation := newLoginHistoryMutation(c.config, OpUpdateOne, withLoginHistoryID(id))
|
|
return &LoginHistoryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for LoginHistory.
|
|
func (c *LoginHistoryClient) Delete() *LoginHistoryDelete {
|
|
mutation := newLoginHistoryMutation(c.config, OpDelete)
|
|
return &LoginHistoryDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *LoginHistoryClient) DeleteOne(_m *LoginHistory) *LoginHistoryDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *LoginHistoryClient) DeleteOneID(id int) *LoginHistoryDeleteOne {
|
|
builder := c.Delete().Where(loginhistory.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &LoginHistoryDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for LoginHistory.
|
|
func (c *LoginHistoryClient) Query() *LoginHistoryQuery {
|
|
return &LoginHistoryQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeLoginHistory},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a LoginHistory entity by its id.
|
|
func (c *LoginHistoryClient) Get(ctx context.Context, id int) (*LoginHistory, error) {
|
|
return c.Query().Where(loginhistory.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *LoginHistoryClient) GetX(ctx context.Context, id int) *LoginHistory {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *LoginHistoryClient) Hooks() []Hook {
|
|
return c.hooks.LoginHistory
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *LoginHistoryClient) Interceptors() []Interceptor {
|
|
return c.inters.LoginHistory
|
|
}
|
|
|
|
func (c *LoginHistoryClient) mutate(ctx context.Context, m *LoginHistoryMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&LoginHistoryCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&LoginHistoryUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&LoginHistoryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&LoginHistoryDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("ent: unknown LoginHistory mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// SiteClient is a client for the Site schema.
|
|
type SiteClient struct {
|
|
config
|
|
}
|
|
|
|
// NewSiteClient returns a client for the Site from the given config.
|
|
func NewSiteClient(c config) *SiteClient {
|
|
return &SiteClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `site.Hooks(f(g(h())))`.
|
|
func (c *SiteClient) Use(hooks ...Hook) {
|
|
c.hooks.Site = append(c.hooks.Site, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `site.Intercept(f(g(h())))`.
|
|
func (c *SiteClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.Site = append(c.inters.Site, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a Site entity.
|
|
func (c *SiteClient) Create() *SiteCreate {
|
|
mutation := newSiteMutation(c.config, OpCreate)
|
|
return &SiteCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of Site entities.
|
|
func (c *SiteClient) CreateBulk(builders ...*SiteCreate) *SiteCreateBulk {
|
|
return &SiteCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
|
|
// a builder and applies setFunc on it.
|
|
func (c *SiteClient) MapCreateBulk(slice any, setFunc func(*SiteCreate, int)) *SiteCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &SiteCreateBulk{err: fmt.Errorf("calling to SiteClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*SiteCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &SiteCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for Site.
|
|
func (c *SiteClient) Update() *SiteUpdate {
|
|
mutation := newSiteMutation(c.config, OpUpdate)
|
|
return &SiteUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *SiteClient) UpdateOne(_m *Site) *SiteUpdateOne {
|
|
mutation := newSiteMutation(c.config, OpUpdateOne, withSite(_m))
|
|
return &SiteUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *SiteClient) UpdateOneID(id int) *SiteUpdateOne {
|
|
mutation := newSiteMutation(c.config, OpUpdateOne, withSiteID(id))
|
|
return &SiteUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for Site.
|
|
func (c *SiteClient) Delete() *SiteDelete {
|
|
mutation := newSiteMutation(c.config, OpDelete)
|
|
return &SiteDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *SiteClient) DeleteOne(_m *Site) *SiteDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *SiteClient) DeleteOneID(id int) *SiteDeleteOne {
|
|
builder := c.Delete().Where(site.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &SiteDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for Site.
|
|
func (c *SiteClient) Query() *SiteQuery {
|
|
return &SiteQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeSite},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a Site entity by its id.
|
|
func (c *SiteClient) Get(ctx context.Context, id int) (*Site, error) {
|
|
return c.Query().Where(site.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *SiteClient) GetX(ctx context.Context, id int) *Site {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *SiteClient) Hooks() []Hook {
|
|
return c.hooks.Site
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *SiteClient) Interceptors() []Interceptor {
|
|
return c.inters.Site
|
|
}
|
|
|
|
func (c *SiteClient) mutate(ctx context.Context, m *SiteMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&SiteCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&SiteUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&SiteUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&SiteDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("ent: unknown Site mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// SiteConfigClient is a client for the SiteConfig schema.
|
|
type SiteConfigClient struct {
|
|
config
|
|
}
|
|
|
|
// NewSiteConfigClient returns a client for the SiteConfig from the given config.
|
|
func NewSiteConfigClient(c config) *SiteConfigClient {
|
|
return &SiteConfigClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `siteconfig.Hooks(f(g(h())))`.
|
|
func (c *SiteConfigClient) Use(hooks ...Hook) {
|
|
c.hooks.SiteConfig = append(c.hooks.SiteConfig, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `siteconfig.Intercept(f(g(h())))`.
|
|
func (c *SiteConfigClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.SiteConfig = append(c.inters.SiteConfig, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a SiteConfig entity.
|
|
func (c *SiteConfigClient) Create() *SiteConfigCreate {
|
|
mutation := newSiteConfigMutation(c.config, OpCreate)
|
|
return &SiteConfigCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of SiteConfig entities.
|
|
func (c *SiteConfigClient) CreateBulk(builders ...*SiteConfigCreate) *SiteConfigCreateBulk {
|
|
return &SiteConfigCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
|
|
// a builder and applies setFunc on it.
|
|
func (c *SiteConfigClient) MapCreateBulk(slice any, setFunc func(*SiteConfigCreate, int)) *SiteConfigCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &SiteConfigCreateBulk{err: fmt.Errorf("calling to SiteConfigClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*SiteConfigCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &SiteConfigCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for SiteConfig.
|
|
func (c *SiteConfigClient) Update() *SiteConfigUpdate {
|
|
mutation := newSiteConfigMutation(c.config, OpUpdate)
|
|
return &SiteConfigUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *SiteConfigClient) UpdateOne(_m *SiteConfig) *SiteConfigUpdateOne {
|
|
mutation := newSiteConfigMutation(c.config, OpUpdateOne, withSiteConfig(_m))
|
|
return &SiteConfigUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *SiteConfigClient) UpdateOneID(id int) *SiteConfigUpdateOne {
|
|
mutation := newSiteConfigMutation(c.config, OpUpdateOne, withSiteConfigID(id))
|
|
return &SiteConfigUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for SiteConfig.
|
|
func (c *SiteConfigClient) Delete() *SiteConfigDelete {
|
|
mutation := newSiteConfigMutation(c.config, OpDelete)
|
|
return &SiteConfigDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *SiteConfigClient) DeleteOne(_m *SiteConfig) *SiteConfigDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *SiteConfigClient) DeleteOneID(id int) *SiteConfigDeleteOne {
|
|
builder := c.Delete().Where(siteconfig.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &SiteConfigDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for SiteConfig.
|
|
func (c *SiteConfigClient) Query() *SiteConfigQuery {
|
|
return &SiteConfigQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeSiteConfig},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a SiteConfig entity by its id.
|
|
func (c *SiteConfigClient) Get(ctx context.Context, id int) (*SiteConfig, error) {
|
|
return c.Query().Where(siteconfig.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *SiteConfigClient) GetX(ctx context.Context, id int) *SiteConfig {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *SiteConfigClient) Hooks() []Hook {
|
|
return c.hooks.SiteConfig
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *SiteConfigClient) Interceptors() []Interceptor {
|
|
return c.inters.SiteConfig
|
|
}
|
|
|
|
func (c *SiteConfigClient) mutate(ctx context.Context, m *SiteConfigMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&SiteConfigCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&SiteConfigUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&SiteConfigUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&SiteConfigDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("ent: unknown SiteConfig mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// UserClient is a client for the User schema.
|
|
type UserClient struct {
|
|
config
|
|
}
|
|
|
|
// NewUserClient returns a client for the User from the given config.
|
|
func NewUserClient(c config) *UserClient {
|
|
return &UserClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `user.Hooks(f(g(h())))`.
|
|
func (c *UserClient) Use(hooks ...Hook) {
|
|
c.hooks.User = append(c.hooks.User, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `user.Intercept(f(g(h())))`.
|
|
func (c *UserClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.User = append(c.inters.User, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a User entity.
|
|
func (c *UserClient) Create() *UserCreate {
|
|
mutation := newUserMutation(c.config, OpCreate)
|
|
return &UserCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of User entities.
|
|
func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk {
|
|
return &UserCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
|
|
// a builder and applies setFunc on it.
|
|
func (c *UserClient) MapCreateBulk(slice any, setFunc func(*UserCreate, int)) *UserCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &UserCreateBulk{err: fmt.Errorf("calling to UserClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*UserCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &UserCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for User.
|
|
func (c *UserClient) Update() *UserUpdate {
|
|
mutation := newUserMutation(c.config, OpUpdate)
|
|
return &UserUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *UserClient) UpdateOne(_m *User) *UserUpdateOne {
|
|
mutation := newUserMutation(c.config, OpUpdateOne, withUser(_m))
|
|
return &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *UserClient) UpdateOneID(id int) *UserUpdateOne {
|
|
mutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))
|
|
return &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for User.
|
|
func (c *UserClient) Delete() *UserDelete {
|
|
mutation := newUserMutation(c.config, OpDelete)
|
|
return &UserDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *UserClient) DeleteOne(_m *User) *UserDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *UserClient) DeleteOneID(id int) *UserDeleteOne {
|
|
builder := c.Delete().Where(user.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &UserDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for User.
|
|
func (c *UserClient) Query() *UserQuery {
|
|
return &UserQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeUser},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a User entity by its id.
|
|
func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {
|
|
return c.Query().Where(user.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *UserClient) GetX(ctx context.Context, id int) *User {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *UserClient) Hooks() []Hook {
|
|
return c.hooks.User
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *UserClient) Interceptors() []Interceptor {
|
|
return c.inters.User
|
|
}
|
|
|
|
func (c *UserClient) mutate(ctx context.Context, m *UserMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&UserCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&UserUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&UserDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("ent: unknown User mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// VisitClient is a client for the Visit schema.
|
|
type VisitClient struct {
|
|
config
|
|
}
|
|
|
|
// NewVisitClient returns a client for the Visit from the given config.
|
|
func NewVisitClient(c config) *VisitClient {
|
|
return &VisitClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `visit.Hooks(f(g(h())))`.
|
|
func (c *VisitClient) Use(hooks ...Hook) {
|
|
c.hooks.Visit = append(c.hooks.Visit, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `visit.Intercept(f(g(h())))`.
|
|
func (c *VisitClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.Visit = append(c.inters.Visit, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a Visit entity.
|
|
func (c *VisitClient) Create() *VisitCreate {
|
|
mutation := newVisitMutation(c.config, OpCreate)
|
|
return &VisitCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of Visit entities.
|
|
func (c *VisitClient) CreateBulk(builders ...*VisitCreate) *VisitCreateBulk {
|
|
return &VisitCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
|
|
// a builder and applies setFunc on it.
|
|
func (c *VisitClient) MapCreateBulk(slice any, setFunc func(*VisitCreate, int)) *VisitCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &VisitCreateBulk{err: fmt.Errorf("calling to VisitClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*VisitCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &VisitCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for Visit.
|
|
func (c *VisitClient) Update() *VisitUpdate {
|
|
mutation := newVisitMutation(c.config, OpUpdate)
|
|
return &VisitUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *VisitClient) UpdateOne(_m *Visit) *VisitUpdateOne {
|
|
mutation := newVisitMutation(c.config, OpUpdateOne, withVisit(_m))
|
|
return &VisitUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *VisitClient) UpdateOneID(id int) *VisitUpdateOne {
|
|
mutation := newVisitMutation(c.config, OpUpdateOne, withVisitID(id))
|
|
return &VisitUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for Visit.
|
|
func (c *VisitClient) Delete() *VisitDelete {
|
|
mutation := newVisitMutation(c.config, OpDelete)
|
|
return &VisitDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *VisitClient) DeleteOne(_m *Visit) *VisitDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *VisitClient) DeleteOneID(id int) *VisitDeleteOne {
|
|
builder := c.Delete().Where(visit.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &VisitDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for Visit.
|
|
func (c *VisitClient) Query() *VisitQuery {
|
|
return &VisitQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeVisit},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a Visit entity by its id.
|
|
func (c *VisitClient) Get(ctx context.Context, id int) (*Visit, error) {
|
|
return c.Query().Where(visit.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *VisitClient) GetX(ctx context.Context, id int) *Visit {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *VisitClient) Hooks() []Hook {
|
|
return c.hooks.Visit
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *VisitClient) Interceptors() []Interceptor {
|
|
return c.inters.Visit
|
|
}
|
|
|
|
func (c *VisitClient) mutate(ctx context.Context, m *VisitMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&VisitCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&VisitUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&VisitUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&VisitDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("ent: unknown Visit mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// hooks and interceptors per client, for fast access.
|
|
type (
|
|
hooks struct {
|
|
Contact, LoginHistory, Site, SiteConfig, User, Visit []ent.Hook
|
|
}
|
|
inters struct {
|
|
Contact, LoginHistory, Site, SiteConfig, User, Visit []ent.Interceptor
|
|
}
|
|
)
|