1281 lines
43 KiB
Go
1281 lines
43 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"log"
|
|
|
|
"github.com/FrankenBotDev/FrankenAPI/ent/migrate"
|
|
|
|
"github.com/FrankenBotDev/FrankenAPI/ent/actions"
|
|
"github.com/FrankenBotDev/FrankenAPI/ent/authorizables"
|
|
"github.com/FrankenBotDev/FrankenAPI/ent/blacklist"
|
|
"github.com/FrankenBotDev/FrankenAPI/ent/logging"
|
|
"github.com/FrankenBotDev/FrankenAPI/ent/punishments"
|
|
"github.com/FrankenBotDev/FrankenAPI/ent/servers"
|
|
"github.com/FrankenBotDev/FrankenAPI/ent/settings"
|
|
"github.com/FrankenBotDev/FrankenAPI/ent/socialmedia"
|
|
"github.com/FrankenBotDev/FrankenAPI/ent/support"
|
|
"github.com/FrankenBotDev/FrankenAPI/ent/supportresponse"
|
|
"github.com/FrankenBotDev/FrankenAPI/ent/user"
|
|
"github.com/FrankenBotDev/FrankenAPI/ent/warns"
|
|
|
|
"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
|
|
// Actions is the client for interacting with the Actions builders.
|
|
Actions *ActionsClient
|
|
// Authorizables is the client for interacting with the Authorizables builders.
|
|
Authorizables *AuthorizablesClient
|
|
// Blacklist is the client for interacting with the Blacklist builders.
|
|
Blacklist *BlacklistClient
|
|
// Logging is the client for interacting with the Logging builders.
|
|
Logging *LoggingClient
|
|
// Punishments is the client for interacting with the Punishments builders.
|
|
Punishments *PunishmentsClient
|
|
// Servers is the client for interacting with the Servers builders.
|
|
Servers *ServersClient
|
|
// Settings is the client for interacting with the Settings builders.
|
|
Settings *SettingsClient
|
|
// Socialmedia is the client for interacting with the Socialmedia builders.
|
|
Socialmedia *SocialmediaClient
|
|
// Support is the client for interacting with the Support builders.
|
|
Support *SupportClient
|
|
// SupportResponse is the client for interacting with the SupportResponse builders.
|
|
SupportResponse *SupportResponseClient
|
|
// User is the client for interacting with the User builders.
|
|
User *UserClient
|
|
// Warns is the client for interacting with the Warns builders.
|
|
Warns *WarnsClient
|
|
}
|
|
|
|
// NewClient creates a new client configured with the given options.
|
|
func NewClient(opts ...Option) *Client {
|
|
cfg := config{log: log.Println, hooks: &hooks{}}
|
|
cfg.options(opts...)
|
|
client := &Client{config: cfg}
|
|
client.init()
|
|
return client
|
|
}
|
|
|
|
func (c *Client) init() {
|
|
c.Schema = migrate.NewSchema(c.driver)
|
|
c.Actions = NewActionsClient(c.config)
|
|
c.Authorizables = NewAuthorizablesClient(c.config)
|
|
c.Blacklist = NewBlacklistClient(c.config)
|
|
c.Logging = NewLoggingClient(c.config)
|
|
c.Punishments = NewPunishmentsClient(c.config)
|
|
c.Servers = NewServersClient(c.config)
|
|
c.Settings = NewSettingsClient(c.config)
|
|
c.Socialmedia = NewSocialmediaClient(c.config)
|
|
c.Support = NewSupportClient(c.config)
|
|
c.SupportResponse = NewSupportResponseClient(c.config)
|
|
c.User = NewUserClient(c.config)
|
|
c.Warns = NewWarnsClient(c.config)
|
|
}
|
|
|
|
// 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)
|
|
}
|
|
}
|
|
|
|
// 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, fmt.Errorf("ent: cannot start a transaction within a transaction")
|
|
}
|
|
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,
|
|
Actions: NewActionsClient(cfg),
|
|
Authorizables: NewAuthorizablesClient(cfg),
|
|
Blacklist: NewBlacklistClient(cfg),
|
|
Logging: NewLoggingClient(cfg),
|
|
Punishments: NewPunishmentsClient(cfg),
|
|
Servers: NewServersClient(cfg),
|
|
Settings: NewSettingsClient(cfg),
|
|
Socialmedia: NewSocialmediaClient(cfg),
|
|
Support: NewSupportClient(cfg),
|
|
SupportResponse: NewSupportResponseClient(cfg),
|
|
User: NewUserClient(cfg),
|
|
Warns: NewWarnsClient(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, fmt.Errorf("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,
|
|
Actions: NewActionsClient(cfg),
|
|
Authorizables: NewAuthorizablesClient(cfg),
|
|
Blacklist: NewBlacklistClient(cfg),
|
|
Logging: NewLoggingClient(cfg),
|
|
Punishments: NewPunishmentsClient(cfg),
|
|
Servers: NewServersClient(cfg),
|
|
Settings: NewSettingsClient(cfg),
|
|
Socialmedia: NewSocialmediaClient(cfg),
|
|
Support: NewSupportClient(cfg),
|
|
SupportResponse: NewSupportResponseClient(cfg),
|
|
User: NewUserClient(cfg),
|
|
Warns: NewWarnsClient(cfg),
|
|
}, nil
|
|
}
|
|
|
|
// Debug returns a new debug-client. It's used to get verbose logging on specific operations.
|
|
//
|
|
// client.Debug().
|
|
// Actions.
|
|
// 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) {
|
|
c.Actions.Use(hooks...)
|
|
c.Authorizables.Use(hooks...)
|
|
c.Blacklist.Use(hooks...)
|
|
c.Logging.Use(hooks...)
|
|
c.Punishments.Use(hooks...)
|
|
c.Servers.Use(hooks...)
|
|
c.Settings.Use(hooks...)
|
|
c.Socialmedia.Use(hooks...)
|
|
c.Support.Use(hooks...)
|
|
c.SupportResponse.Use(hooks...)
|
|
c.User.Use(hooks...)
|
|
c.Warns.Use(hooks...)
|
|
}
|
|
|
|
// ActionsClient is a client for the Actions schema.
|
|
type ActionsClient struct {
|
|
config
|
|
}
|
|
|
|
// NewActionsClient returns a client for the Actions from the given config.
|
|
func NewActionsClient(c config) *ActionsClient {
|
|
return &ActionsClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `actions.Hooks(f(g(h())))`.
|
|
func (c *ActionsClient) Use(hooks ...Hook) {
|
|
c.hooks.Actions = append(c.hooks.Actions, hooks...)
|
|
}
|
|
|
|
// Create returns a builder for creating a Actions entity.
|
|
func (c *ActionsClient) Create() *ActionsCreate {
|
|
mutation := newActionsMutation(c.config, OpCreate)
|
|
return &ActionsCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of Actions entities.
|
|
func (c *ActionsClient) CreateBulk(builders ...*ActionsCreate) *ActionsCreateBulk {
|
|
return &ActionsCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for Actions.
|
|
func (c *ActionsClient) Update() *ActionsUpdate {
|
|
mutation := newActionsMutation(c.config, OpUpdate)
|
|
return &ActionsUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *ActionsClient) UpdateOne(a *Actions) *ActionsUpdateOne {
|
|
mutation := newActionsMutation(c.config, OpUpdateOne, withActions(a))
|
|
return &ActionsUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *ActionsClient) UpdateOneID(id int) *ActionsUpdateOne {
|
|
mutation := newActionsMutation(c.config, OpUpdateOne, withActionsID(id))
|
|
return &ActionsUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for Actions.
|
|
func (c *ActionsClient) Delete() *ActionsDelete {
|
|
mutation := newActionsMutation(c.config, OpDelete)
|
|
return &ActionsDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *ActionsClient) DeleteOne(a *Actions) *ActionsDeleteOne {
|
|
return c.DeleteOneID(a.ID)
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity by its id.
|
|
func (c *ActionsClient) DeleteOneID(id int) *ActionsDeleteOne {
|
|
builder := c.Delete().Where(actions.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &ActionsDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for Actions.
|
|
func (c *ActionsClient) Query() *ActionsQuery {
|
|
return &ActionsQuery{
|
|
config: c.config,
|
|
}
|
|
}
|
|
|
|
// Get returns a Actions entity by its id.
|
|
func (c *ActionsClient) Get(ctx context.Context, id int) (*Actions, error) {
|
|
return c.Query().Where(actions.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *ActionsClient) GetX(ctx context.Context, id int) *Actions {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *ActionsClient) Hooks() []Hook {
|
|
return c.hooks.Actions
|
|
}
|
|
|
|
// AuthorizablesClient is a client for the Authorizables schema.
|
|
type AuthorizablesClient struct {
|
|
config
|
|
}
|
|
|
|
// NewAuthorizablesClient returns a client for the Authorizables from the given config.
|
|
func NewAuthorizablesClient(c config) *AuthorizablesClient {
|
|
return &AuthorizablesClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `authorizables.Hooks(f(g(h())))`.
|
|
func (c *AuthorizablesClient) Use(hooks ...Hook) {
|
|
c.hooks.Authorizables = append(c.hooks.Authorizables, hooks...)
|
|
}
|
|
|
|
// Create returns a builder for creating a Authorizables entity.
|
|
func (c *AuthorizablesClient) Create() *AuthorizablesCreate {
|
|
mutation := newAuthorizablesMutation(c.config, OpCreate)
|
|
return &AuthorizablesCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of Authorizables entities.
|
|
func (c *AuthorizablesClient) CreateBulk(builders ...*AuthorizablesCreate) *AuthorizablesCreateBulk {
|
|
return &AuthorizablesCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for Authorizables.
|
|
func (c *AuthorizablesClient) Update() *AuthorizablesUpdate {
|
|
mutation := newAuthorizablesMutation(c.config, OpUpdate)
|
|
return &AuthorizablesUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *AuthorizablesClient) UpdateOne(a *Authorizables) *AuthorizablesUpdateOne {
|
|
mutation := newAuthorizablesMutation(c.config, OpUpdateOne, withAuthorizables(a))
|
|
return &AuthorizablesUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *AuthorizablesClient) UpdateOneID(id int) *AuthorizablesUpdateOne {
|
|
mutation := newAuthorizablesMutation(c.config, OpUpdateOne, withAuthorizablesID(id))
|
|
return &AuthorizablesUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for Authorizables.
|
|
func (c *AuthorizablesClient) Delete() *AuthorizablesDelete {
|
|
mutation := newAuthorizablesMutation(c.config, OpDelete)
|
|
return &AuthorizablesDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *AuthorizablesClient) DeleteOne(a *Authorizables) *AuthorizablesDeleteOne {
|
|
return c.DeleteOneID(a.ID)
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity by its id.
|
|
func (c *AuthorizablesClient) DeleteOneID(id int) *AuthorizablesDeleteOne {
|
|
builder := c.Delete().Where(authorizables.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &AuthorizablesDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for Authorizables.
|
|
func (c *AuthorizablesClient) Query() *AuthorizablesQuery {
|
|
return &AuthorizablesQuery{
|
|
config: c.config,
|
|
}
|
|
}
|
|
|
|
// Get returns a Authorizables entity by its id.
|
|
func (c *AuthorizablesClient) Get(ctx context.Context, id int) (*Authorizables, error) {
|
|
return c.Query().Where(authorizables.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *AuthorizablesClient) GetX(ctx context.Context, id int) *Authorizables {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *AuthorizablesClient) Hooks() []Hook {
|
|
return c.hooks.Authorizables
|
|
}
|
|
|
|
// BlacklistClient is a client for the Blacklist schema.
|
|
type BlacklistClient struct {
|
|
config
|
|
}
|
|
|
|
// NewBlacklistClient returns a client for the Blacklist from the given config.
|
|
func NewBlacklistClient(c config) *BlacklistClient {
|
|
return &BlacklistClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `blacklist.Hooks(f(g(h())))`.
|
|
func (c *BlacklistClient) Use(hooks ...Hook) {
|
|
c.hooks.Blacklist = append(c.hooks.Blacklist, hooks...)
|
|
}
|
|
|
|
// Create returns a builder for creating a Blacklist entity.
|
|
func (c *BlacklistClient) Create() *BlacklistCreate {
|
|
mutation := newBlacklistMutation(c.config, OpCreate)
|
|
return &BlacklistCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of Blacklist entities.
|
|
func (c *BlacklistClient) CreateBulk(builders ...*BlacklistCreate) *BlacklistCreateBulk {
|
|
return &BlacklistCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for Blacklist.
|
|
func (c *BlacklistClient) Update() *BlacklistUpdate {
|
|
mutation := newBlacklistMutation(c.config, OpUpdate)
|
|
return &BlacklistUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *BlacklistClient) UpdateOne(b *Blacklist) *BlacklistUpdateOne {
|
|
mutation := newBlacklistMutation(c.config, OpUpdateOne, withBlacklist(b))
|
|
return &BlacklistUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *BlacklistClient) UpdateOneID(id int) *BlacklistUpdateOne {
|
|
mutation := newBlacklistMutation(c.config, OpUpdateOne, withBlacklistID(id))
|
|
return &BlacklistUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for Blacklist.
|
|
func (c *BlacklistClient) Delete() *BlacklistDelete {
|
|
mutation := newBlacklistMutation(c.config, OpDelete)
|
|
return &BlacklistDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *BlacklistClient) DeleteOne(b *Blacklist) *BlacklistDeleteOne {
|
|
return c.DeleteOneID(b.ID)
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity by its id.
|
|
func (c *BlacklistClient) DeleteOneID(id int) *BlacklistDeleteOne {
|
|
builder := c.Delete().Where(blacklist.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &BlacklistDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for Blacklist.
|
|
func (c *BlacklistClient) Query() *BlacklistQuery {
|
|
return &BlacklistQuery{
|
|
config: c.config,
|
|
}
|
|
}
|
|
|
|
// Get returns a Blacklist entity by its id.
|
|
func (c *BlacklistClient) Get(ctx context.Context, id int) (*Blacklist, error) {
|
|
return c.Query().Where(blacklist.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *BlacklistClient) GetX(ctx context.Context, id int) *Blacklist {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *BlacklistClient) Hooks() []Hook {
|
|
return c.hooks.Blacklist
|
|
}
|
|
|
|
// LoggingClient is a client for the Logging schema.
|
|
type LoggingClient struct {
|
|
config
|
|
}
|
|
|
|
// NewLoggingClient returns a client for the Logging from the given config.
|
|
func NewLoggingClient(c config) *LoggingClient {
|
|
return &LoggingClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `logging.Hooks(f(g(h())))`.
|
|
func (c *LoggingClient) Use(hooks ...Hook) {
|
|
c.hooks.Logging = append(c.hooks.Logging, hooks...)
|
|
}
|
|
|
|
// Create returns a builder for creating a Logging entity.
|
|
func (c *LoggingClient) Create() *LoggingCreate {
|
|
mutation := newLoggingMutation(c.config, OpCreate)
|
|
return &LoggingCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of Logging entities.
|
|
func (c *LoggingClient) CreateBulk(builders ...*LoggingCreate) *LoggingCreateBulk {
|
|
return &LoggingCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for Logging.
|
|
func (c *LoggingClient) Update() *LoggingUpdate {
|
|
mutation := newLoggingMutation(c.config, OpUpdate)
|
|
return &LoggingUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *LoggingClient) UpdateOne(l *Logging) *LoggingUpdateOne {
|
|
mutation := newLoggingMutation(c.config, OpUpdateOne, withLogging(l))
|
|
return &LoggingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *LoggingClient) UpdateOneID(id int) *LoggingUpdateOne {
|
|
mutation := newLoggingMutation(c.config, OpUpdateOne, withLoggingID(id))
|
|
return &LoggingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for Logging.
|
|
func (c *LoggingClient) Delete() *LoggingDelete {
|
|
mutation := newLoggingMutation(c.config, OpDelete)
|
|
return &LoggingDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *LoggingClient) DeleteOne(l *Logging) *LoggingDeleteOne {
|
|
return c.DeleteOneID(l.ID)
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity by its id.
|
|
func (c *LoggingClient) DeleteOneID(id int) *LoggingDeleteOne {
|
|
builder := c.Delete().Where(logging.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &LoggingDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for Logging.
|
|
func (c *LoggingClient) Query() *LoggingQuery {
|
|
return &LoggingQuery{
|
|
config: c.config,
|
|
}
|
|
}
|
|
|
|
// Get returns a Logging entity by its id.
|
|
func (c *LoggingClient) Get(ctx context.Context, id int) (*Logging, error) {
|
|
return c.Query().Where(logging.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *LoggingClient) GetX(ctx context.Context, id int) *Logging {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *LoggingClient) Hooks() []Hook {
|
|
return c.hooks.Logging
|
|
}
|
|
|
|
// PunishmentsClient is a client for the Punishments schema.
|
|
type PunishmentsClient struct {
|
|
config
|
|
}
|
|
|
|
// NewPunishmentsClient returns a client for the Punishments from the given config.
|
|
func NewPunishmentsClient(c config) *PunishmentsClient {
|
|
return &PunishmentsClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `punishments.Hooks(f(g(h())))`.
|
|
func (c *PunishmentsClient) Use(hooks ...Hook) {
|
|
c.hooks.Punishments = append(c.hooks.Punishments, hooks...)
|
|
}
|
|
|
|
// Create returns a builder for creating a Punishments entity.
|
|
func (c *PunishmentsClient) Create() *PunishmentsCreate {
|
|
mutation := newPunishmentsMutation(c.config, OpCreate)
|
|
return &PunishmentsCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of Punishments entities.
|
|
func (c *PunishmentsClient) CreateBulk(builders ...*PunishmentsCreate) *PunishmentsCreateBulk {
|
|
return &PunishmentsCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for Punishments.
|
|
func (c *PunishmentsClient) Update() *PunishmentsUpdate {
|
|
mutation := newPunishmentsMutation(c.config, OpUpdate)
|
|
return &PunishmentsUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *PunishmentsClient) UpdateOne(pu *Punishments) *PunishmentsUpdateOne {
|
|
mutation := newPunishmentsMutation(c.config, OpUpdateOne, withPunishments(pu))
|
|
return &PunishmentsUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *PunishmentsClient) UpdateOneID(id int) *PunishmentsUpdateOne {
|
|
mutation := newPunishmentsMutation(c.config, OpUpdateOne, withPunishmentsID(id))
|
|
return &PunishmentsUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for Punishments.
|
|
func (c *PunishmentsClient) Delete() *PunishmentsDelete {
|
|
mutation := newPunishmentsMutation(c.config, OpDelete)
|
|
return &PunishmentsDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *PunishmentsClient) DeleteOne(pu *Punishments) *PunishmentsDeleteOne {
|
|
return c.DeleteOneID(pu.ID)
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity by its id.
|
|
func (c *PunishmentsClient) DeleteOneID(id int) *PunishmentsDeleteOne {
|
|
builder := c.Delete().Where(punishments.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &PunishmentsDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for Punishments.
|
|
func (c *PunishmentsClient) Query() *PunishmentsQuery {
|
|
return &PunishmentsQuery{
|
|
config: c.config,
|
|
}
|
|
}
|
|
|
|
// Get returns a Punishments entity by its id.
|
|
func (c *PunishmentsClient) Get(ctx context.Context, id int) (*Punishments, error) {
|
|
return c.Query().Where(punishments.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *PunishmentsClient) GetX(ctx context.Context, id int) *Punishments {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *PunishmentsClient) Hooks() []Hook {
|
|
return c.hooks.Punishments
|
|
}
|
|
|
|
// ServersClient is a client for the Servers schema.
|
|
type ServersClient struct {
|
|
config
|
|
}
|
|
|
|
// NewServersClient returns a client for the Servers from the given config.
|
|
func NewServersClient(c config) *ServersClient {
|
|
return &ServersClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `servers.Hooks(f(g(h())))`.
|
|
func (c *ServersClient) Use(hooks ...Hook) {
|
|
c.hooks.Servers = append(c.hooks.Servers, hooks...)
|
|
}
|
|
|
|
// Create returns a builder for creating a Servers entity.
|
|
func (c *ServersClient) Create() *ServersCreate {
|
|
mutation := newServersMutation(c.config, OpCreate)
|
|
return &ServersCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of Servers entities.
|
|
func (c *ServersClient) CreateBulk(builders ...*ServersCreate) *ServersCreateBulk {
|
|
return &ServersCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for Servers.
|
|
func (c *ServersClient) Update() *ServersUpdate {
|
|
mutation := newServersMutation(c.config, OpUpdate)
|
|
return &ServersUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *ServersClient) UpdateOne(s *Servers) *ServersUpdateOne {
|
|
mutation := newServersMutation(c.config, OpUpdateOne, withServers(s))
|
|
return &ServersUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *ServersClient) UpdateOneID(id int) *ServersUpdateOne {
|
|
mutation := newServersMutation(c.config, OpUpdateOne, withServersID(id))
|
|
return &ServersUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for Servers.
|
|
func (c *ServersClient) Delete() *ServersDelete {
|
|
mutation := newServersMutation(c.config, OpDelete)
|
|
return &ServersDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *ServersClient) DeleteOne(s *Servers) *ServersDeleteOne {
|
|
return c.DeleteOneID(s.ID)
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity by its id.
|
|
func (c *ServersClient) DeleteOneID(id int) *ServersDeleteOne {
|
|
builder := c.Delete().Where(servers.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &ServersDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for Servers.
|
|
func (c *ServersClient) Query() *ServersQuery {
|
|
return &ServersQuery{
|
|
config: c.config,
|
|
}
|
|
}
|
|
|
|
// Get returns a Servers entity by its id.
|
|
func (c *ServersClient) Get(ctx context.Context, id int) (*Servers, error) {
|
|
return c.Query().Where(servers.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *ServersClient) GetX(ctx context.Context, id int) *Servers {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *ServersClient) Hooks() []Hook {
|
|
return c.hooks.Servers
|
|
}
|
|
|
|
// SettingsClient is a client for the Settings schema.
|
|
type SettingsClient struct {
|
|
config
|
|
}
|
|
|
|
// NewSettingsClient returns a client for the Settings from the given config.
|
|
func NewSettingsClient(c config) *SettingsClient {
|
|
return &SettingsClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `settings.Hooks(f(g(h())))`.
|
|
func (c *SettingsClient) Use(hooks ...Hook) {
|
|
c.hooks.Settings = append(c.hooks.Settings, hooks...)
|
|
}
|
|
|
|
// Create returns a builder for creating a Settings entity.
|
|
func (c *SettingsClient) Create() *SettingsCreate {
|
|
mutation := newSettingsMutation(c.config, OpCreate)
|
|
return &SettingsCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of Settings entities.
|
|
func (c *SettingsClient) CreateBulk(builders ...*SettingsCreate) *SettingsCreateBulk {
|
|
return &SettingsCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for Settings.
|
|
func (c *SettingsClient) Update() *SettingsUpdate {
|
|
mutation := newSettingsMutation(c.config, OpUpdate)
|
|
return &SettingsUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *SettingsClient) UpdateOne(s *Settings) *SettingsUpdateOne {
|
|
mutation := newSettingsMutation(c.config, OpUpdateOne, withSettings(s))
|
|
return &SettingsUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *SettingsClient) UpdateOneID(id int) *SettingsUpdateOne {
|
|
mutation := newSettingsMutation(c.config, OpUpdateOne, withSettingsID(id))
|
|
return &SettingsUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for Settings.
|
|
func (c *SettingsClient) Delete() *SettingsDelete {
|
|
mutation := newSettingsMutation(c.config, OpDelete)
|
|
return &SettingsDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *SettingsClient) DeleteOne(s *Settings) *SettingsDeleteOne {
|
|
return c.DeleteOneID(s.ID)
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity by its id.
|
|
func (c *SettingsClient) DeleteOneID(id int) *SettingsDeleteOne {
|
|
builder := c.Delete().Where(settings.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &SettingsDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for Settings.
|
|
func (c *SettingsClient) Query() *SettingsQuery {
|
|
return &SettingsQuery{
|
|
config: c.config,
|
|
}
|
|
}
|
|
|
|
// Get returns a Settings entity by its id.
|
|
func (c *SettingsClient) Get(ctx context.Context, id int) (*Settings, error) {
|
|
return c.Query().Where(settings.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *SettingsClient) GetX(ctx context.Context, id int) *Settings {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *SettingsClient) Hooks() []Hook {
|
|
return c.hooks.Settings
|
|
}
|
|
|
|
// SocialmediaClient is a client for the Socialmedia schema.
|
|
type SocialmediaClient struct {
|
|
config
|
|
}
|
|
|
|
// NewSocialmediaClient returns a client for the Socialmedia from the given config.
|
|
func NewSocialmediaClient(c config) *SocialmediaClient {
|
|
return &SocialmediaClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `socialmedia.Hooks(f(g(h())))`.
|
|
func (c *SocialmediaClient) Use(hooks ...Hook) {
|
|
c.hooks.Socialmedia = append(c.hooks.Socialmedia, hooks...)
|
|
}
|
|
|
|
// Create returns a builder for creating a Socialmedia entity.
|
|
func (c *SocialmediaClient) Create() *SocialmediaCreate {
|
|
mutation := newSocialmediaMutation(c.config, OpCreate)
|
|
return &SocialmediaCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of Socialmedia entities.
|
|
func (c *SocialmediaClient) CreateBulk(builders ...*SocialmediaCreate) *SocialmediaCreateBulk {
|
|
return &SocialmediaCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for Socialmedia.
|
|
func (c *SocialmediaClient) Update() *SocialmediaUpdate {
|
|
mutation := newSocialmediaMutation(c.config, OpUpdate)
|
|
return &SocialmediaUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *SocialmediaClient) UpdateOne(s *Socialmedia) *SocialmediaUpdateOne {
|
|
mutation := newSocialmediaMutation(c.config, OpUpdateOne, withSocialmedia(s))
|
|
return &SocialmediaUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *SocialmediaClient) UpdateOneID(id int) *SocialmediaUpdateOne {
|
|
mutation := newSocialmediaMutation(c.config, OpUpdateOne, withSocialmediaID(id))
|
|
return &SocialmediaUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for Socialmedia.
|
|
func (c *SocialmediaClient) Delete() *SocialmediaDelete {
|
|
mutation := newSocialmediaMutation(c.config, OpDelete)
|
|
return &SocialmediaDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *SocialmediaClient) DeleteOne(s *Socialmedia) *SocialmediaDeleteOne {
|
|
return c.DeleteOneID(s.ID)
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity by its id.
|
|
func (c *SocialmediaClient) DeleteOneID(id int) *SocialmediaDeleteOne {
|
|
builder := c.Delete().Where(socialmedia.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &SocialmediaDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for Socialmedia.
|
|
func (c *SocialmediaClient) Query() *SocialmediaQuery {
|
|
return &SocialmediaQuery{
|
|
config: c.config,
|
|
}
|
|
}
|
|
|
|
// Get returns a Socialmedia entity by its id.
|
|
func (c *SocialmediaClient) Get(ctx context.Context, id int) (*Socialmedia, error) {
|
|
return c.Query().Where(socialmedia.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *SocialmediaClient) GetX(ctx context.Context, id int) *Socialmedia {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *SocialmediaClient) Hooks() []Hook {
|
|
return c.hooks.Socialmedia
|
|
}
|
|
|
|
// SupportClient is a client for the Support schema.
|
|
type SupportClient struct {
|
|
config
|
|
}
|
|
|
|
// NewSupportClient returns a client for the Support from the given config.
|
|
func NewSupportClient(c config) *SupportClient {
|
|
return &SupportClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `support.Hooks(f(g(h())))`.
|
|
func (c *SupportClient) Use(hooks ...Hook) {
|
|
c.hooks.Support = append(c.hooks.Support, hooks...)
|
|
}
|
|
|
|
// Create returns a builder for creating a Support entity.
|
|
func (c *SupportClient) Create() *SupportCreate {
|
|
mutation := newSupportMutation(c.config, OpCreate)
|
|
return &SupportCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of Support entities.
|
|
func (c *SupportClient) CreateBulk(builders ...*SupportCreate) *SupportCreateBulk {
|
|
return &SupportCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for Support.
|
|
func (c *SupportClient) Update() *SupportUpdate {
|
|
mutation := newSupportMutation(c.config, OpUpdate)
|
|
return &SupportUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *SupportClient) UpdateOne(s *Support) *SupportUpdateOne {
|
|
mutation := newSupportMutation(c.config, OpUpdateOne, withSupport(s))
|
|
return &SupportUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *SupportClient) UpdateOneID(id int) *SupportUpdateOne {
|
|
mutation := newSupportMutation(c.config, OpUpdateOne, withSupportID(id))
|
|
return &SupportUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for Support.
|
|
func (c *SupportClient) Delete() *SupportDelete {
|
|
mutation := newSupportMutation(c.config, OpDelete)
|
|
return &SupportDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *SupportClient) DeleteOne(s *Support) *SupportDeleteOne {
|
|
return c.DeleteOneID(s.ID)
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity by its id.
|
|
func (c *SupportClient) DeleteOneID(id int) *SupportDeleteOne {
|
|
builder := c.Delete().Where(support.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &SupportDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for Support.
|
|
func (c *SupportClient) Query() *SupportQuery {
|
|
return &SupportQuery{
|
|
config: c.config,
|
|
}
|
|
}
|
|
|
|
// Get returns a Support entity by its id.
|
|
func (c *SupportClient) Get(ctx context.Context, id int) (*Support, error) {
|
|
return c.Query().Where(support.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *SupportClient) GetX(ctx context.Context, id int) *Support {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *SupportClient) Hooks() []Hook {
|
|
return c.hooks.Support
|
|
}
|
|
|
|
// SupportResponseClient is a client for the SupportResponse schema.
|
|
type SupportResponseClient struct {
|
|
config
|
|
}
|
|
|
|
// NewSupportResponseClient returns a client for the SupportResponse from the given config.
|
|
func NewSupportResponseClient(c config) *SupportResponseClient {
|
|
return &SupportResponseClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `supportresponse.Hooks(f(g(h())))`.
|
|
func (c *SupportResponseClient) Use(hooks ...Hook) {
|
|
c.hooks.SupportResponse = append(c.hooks.SupportResponse, hooks...)
|
|
}
|
|
|
|
// Create returns a builder for creating a SupportResponse entity.
|
|
func (c *SupportResponseClient) Create() *SupportResponseCreate {
|
|
mutation := newSupportResponseMutation(c.config, OpCreate)
|
|
return &SupportResponseCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of SupportResponse entities.
|
|
func (c *SupportResponseClient) CreateBulk(builders ...*SupportResponseCreate) *SupportResponseCreateBulk {
|
|
return &SupportResponseCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for SupportResponse.
|
|
func (c *SupportResponseClient) Update() *SupportResponseUpdate {
|
|
mutation := newSupportResponseMutation(c.config, OpUpdate)
|
|
return &SupportResponseUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *SupportResponseClient) UpdateOne(sr *SupportResponse) *SupportResponseUpdateOne {
|
|
mutation := newSupportResponseMutation(c.config, OpUpdateOne, withSupportResponse(sr))
|
|
return &SupportResponseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *SupportResponseClient) UpdateOneID(id int) *SupportResponseUpdateOne {
|
|
mutation := newSupportResponseMutation(c.config, OpUpdateOne, withSupportResponseID(id))
|
|
return &SupportResponseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for SupportResponse.
|
|
func (c *SupportResponseClient) Delete() *SupportResponseDelete {
|
|
mutation := newSupportResponseMutation(c.config, OpDelete)
|
|
return &SupportResponseDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *SupportResponseClient) DeleteOne(sr *SupportResponse) *SupportResponseDeleteOne {
|
|
return c.DeleteOneID(sr.ID)
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity by its id.
|
|
func (c *SupportResponseClient) DeleteOneID(id int) *SupportResponseDeleteOne {
|
|
builder := c.Delete().Where(supportresponse.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &SupportResponseDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for SupportResponse.
|
|
func (c *SupportResponseClient) Query() *SupportResponseQuery {
|
|
return &SupportResponseQuery{
|
|
config: c.config,
|
|
}
|
|
}
|
|
|
|
// Get returns a SupportResponse entity by its id.
|
|
func (c *SupportResponseClient) Get(ctx context.Context, id int) (*SupportResponse, error) {
|
|
return c.Query().Where(supportresponse.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *SupportResponseClient) GetX(ctx context.Context, id int) *SupportResponse {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *SupportResponseClient) Hooks() []Hook {
|
|
return c.hooks.SupportResponse
|
|
}
|
|
|
|
// 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...)
|
|
}
|
|
|
|
// 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}
|
|
}
|
|
|
|
// 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(u *User) *UserUpdateOne {
|
|
mutation := newUserMutation(c.config, OpUpdateOne, withUser(u))
|
|
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(u *User) *UserDeleteOne {
|
|
return c.DeleteOneID(u.ID)
|
|
}
|
|
|
|
// DeleteOne 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,
|
|
}
|
|
}
|
|
|
|
// 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
|
|
}
|
|
|
|
// WarnsClient is a client for the Warns schema.
|
|
type WarnsClient struct {
|
|
config
|
|
}
|
|
|
|
// NewWarnsClient returns a client for the Warns from the given config.
|
|
func NewWarnsClient(c config) *WarnsClient {
|
|
return &WarnsClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `warns.Hooks(f(g(h())))`.
|
|
func (c *WarnsClient) Use(hooks ...Hook) {
|
|
c.hooks.Warns = append(c.hooks.Warns, hooks...)
|
|
}
|
|
|
|
// Create returns a builder for creating a Warns entity.
|
|
func (c *WarnsClient) Create() *WarnsCreate {
|
|
mutation := newWarnsMutation(c.config, OpCreate)
|
|
return &WarnsCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of Warns entities.
|
|
func (c *WarnsClient) CreateBulk(builders ...*WarnsCreate) *WarnsCreateBulk {
|
|
return &WarnsCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for Warns.
|
|
func (c *WarnsClient) Update() *WarnsUpdate {
|
|
mutation := newWarnsMutation(c.config, OpUpdate)
|
|
return &WarnsUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *WarnsClient) UpdateOne(w *Warns) *WarnsUpdateOne {
|
|
mutation := newWarnsMutation(c.config, OpUpdateOne, withWarns(w))
|
|
return &WarnsUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *WarnsClient) UpdateOneID(id int) *WarnsUpdateOne {
|
|
mutation := newWarnsMutation(c.config, OpUpdateOne, withWarnsID(id))
|
|
return &WarnsUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for Warns.
|
|
func (c *WarnsClient) Delete() *WarnsDelete {
|
|
mutation := newWarnsMutation(c.config, OpDelete)
|
|
return &WarnsDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *WarnsClient) DeleteOne(w *Warns) *WarnsDeleteOne {
|
|
return c.DeleteOneID(w.ID)
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity by its id.
|
|
func (c *WarnsClient) DeleteOneID(id int) *WarnsDeleteOne {
|
|
builder := c.Delete().Where(warns.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &WarnsDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for Warns.
|
|
func (c *WarnsClient) Query() *WarnsQuery {
|
|
return &WarnsQuery{
|
|
config: c.config,
|
|
}
|
|
}
|
|
|
|
// Get returns a Warns entity by its id.
|
|
func (c *WarnsClient) Get(ctx context.Context, id int) (*Warns, error) {
|
|
return c.Query().Where(warns.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *WarnsClient) GetX(ctx context.Context, id int) *Warns {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *WarnsClient) Hooks() []Hook {
|
|
return c.hooks.Warns
|
|
}
|