mirror of
https://github.com/chaitin/MonkeyCode.git
synced 2026-11-22 19:39:31 +08:00
- 新增 git_bots, git_bot_users, git_bot_tasks, project_git_bots 表 - 添加 user, host, project 到 gitbot 的关联边 - 使用 soft delete 和 created_at 游标
6820 lines
255 KiB
Go
6820 lines
255 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package db
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
"log"
|
|
"reflect"
|
|
|
|
"github.com/chaitin/MonkeyCode/backend/db/migrate"
|
|
"github.com/google/uuid"
|
|
|
|
"entgo.io/ent"
|
|
"entgo.io/ent/dialect"
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
"github.com/chaitin/MonkeyCode/backend/db/audit"
|
|
"github.com/chaitin/MonkeyCode/backend/db/gitbot"
|
|
"github.com/chaitin/MonkeyCode/backend/db/gitbottask"
|
|
"github.com/chaitin/MonkeyCode/backend/db/gitbotuser"
|
|
"github.com/chaitin/MonkeyCode/backend/db/gitidentity"
|
|
"github.com/chaitin/MonkeyCode/backend/db/host"
|
|
"github.com/chaitin/MonkeyCode/backend/db/image"
|
|
"github.com/chaitin/MonkeyCode/backend/db/model"
|
|
"github.com/chaitin/MonkeyCode/backend/db/notifychannel"
|
|
"github.com/chaitin/MonkeyCode/backend/db/notifysendlog"
|
|
"github.com/chaitin/MonkeyCode/backend/db/notifysubscription"
|
|
"github.com/chaitin/MonkeyCode/backend/db/project"
|
|
"github.com/chaitin/MonkeyCode/backend/db/projectcollaborator"
|
|
"github.com/chaitin/MonkeyCode/backend/db/projectgitbot"
|
|
"github.com/chaitin/MonkeyCode/backend/db/projectissue"
|
|
"github.com/chaitin/MonkeyCode/backend/db/projectissuecomment"
|
|
"github.com/chaitin/MonkeyCode/backend/db/projecttask"
|
|
"github.com/chaitin/MonkeyCode/backend/db/task"
|
|
"github.com/chaitin/MonkeyCode/backend/db/taskvirtualmachine"
|
|
"github.com/chaitin/MonkeyCode/backend/db/team"
|
|
"github.com/chaitin/MonkeyCode/backend/db/teamgroup"
|
|
"github.com/chaitin/MonkeyCode/backend/db/teamgrouphost"
|
|
"github.com/chaitin/MonkeyCode/backend/db/teamgroupimage"
|
|
"github.com/chaitin/MonkeyCode/backend/db/teamgroupmember"
|
|
"github.com/chaitin/MonkeyCode/backend/db/teamgroupmodel"
|
|
"github.com/chaitin/MonkeyCode/backend/db/teamhost"
|
|
"github.com/chaitin/MonkeyCode/backend/db/teamimage"
|
|
"github.com/chaitin/MonkeyCode/backend/db/teammember"
|
|
"github.com/chaitin/MonkeyCode/backend/db/teammodel"
|
|
"github.com/chaitin/MonkeyCode/backend/db/user"
|
|
"github.com/chaitin/MonkeyCode/backend/db/useridentity"
|
|
"github.com/chaitin/MonkeyCode/backend/db/virtualmachine"
|
|
|
|
stdsql "database/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
|
|
// Audit is the client for interacting with the Audit builders.
|
|
Audit *AuditClient
|
|
// GitBot is the client for interacting with the GitBot builders.
|
|
GitBot *GitBotClient
|
|
// GitBotTask is the client for interacting with the GitBotTask builders.
|
|
GitBotTask *GitBotTaskClient
|
|
// GitBotUser is the client for interacting with the GitBotUser builders.
|
|
GitBotUser *GitBotUserClient
|
|
// GitIdentity is the client for interacting with the GitIdentity builders.
|
|
GitIdentity *GitIdentityClient
|
|
// Host is the client for interacting with the Host builders.
|
|
Host *HostClient
|
|
// Image is the client for interacting with the Image builders.
|
|
Image *ImageClient
|
|
// Model is the client for interacting with the Model builders.
|
|
Model *ModelClient
|
|
// NotifyChannel is the client for interacting with the NotifyChannel builders.
|
|
NotifyChannel *NotifyChannelClient
|
|
// NotifySendLog is the client for interacting with the NotifySendLog builders.
|
|
NotifySendLog *NotifySendLogClient
|
|
// NotifySubscription is the client for interacting with the NotifySubscription builders.
|
|
NotifySubscription *NotifySubscriptionClient
|
|
// Project is the client for interacting with the Project builders.
|
|
Project *ProjectClient
|
|
// ProjectCollaborator is the client for interacting with the ProjectCollaborator builders.
|
|
ProjectCollaborator *ProjectCollaboratorClient
|
|
// ProjectGitBot is the client for interacting with the ProjectGitBot builders.
|
|
ProjectGitBot *ProjectGitBotClient
|
|
// ProjectIssue is the client for interacting with the ProjectIssue builders.
|
|
ProjectIssue *ProjectIssueClient
|
|
// ProjectIssueComment is the client for interacting with the ProjectIssueComment builders.
|
|
ProjectIssueComment *ProjectIssueCommentClient
|
|
// ProjectTask is the client for interacting with the ProjectTask builders.
|
|
ProjectTask *ProjectTaskClient
|
|
// Task is the client for interacting with the Task builders.
|
|
Task *TaskClient
|
|
// TaskVirtualMachine is the client for interacting with the TaskVirtualMachine builders.
|
|
TaskVirtualMachine *TaskVirtualMachineClient
|
|
// Team is the client for interacting with the Team builders.
|
|
Team *TeamClient
|
|
// TeamGroup is the client for interacting with the TeamGroup builders.
|
|
TeamGroup *TeamGroupClient
|
|
// TeamGroupHost is the client for interacting with the TeamGroupHost builders.
|
|
TeamGroupHost *TeamGroupHostClient
|
|
// TeamGroupImage is the client for interacting with the TeamGroupImage builders.
|
|
TeamGroupImage *TeamGroupImageClient
|
|
// TeamGroupMember is the client for interacting with the TeamGroupMember builders.
|
|
TeamGroupMember *TeamGroupMemberClient
|
|
// TeamGroupModel is the client for interacting with the TeamGroupModel builders.
|
|
TeamGroupModel *TeamGroupModelClient
|
|
// TeamHost is the client for interacting with the TeamHost builders.
|
|
TeamHost *TeamHostClient
|
|
// TeamImage is the client for interacting with the TeamImage builders.
|
|
TeamImage *TeamImageClient
|
|
// TeamMember is the client for interacting with the TeamMember builders.
|
|
TeamMember *TeamMemberClient
|
|
// TeamModel is the client for interacting with the TeamModel builders.
|
|
TeamModel *TeamModelClient
|
|
// User is the client for interacting with the User builders.
|
|
User *UserClient
|
|
// UserIdentity is the client for interacting with the UserIdentity builders.
|
|
UserIdentity *UserIdentityClient
|
|
// VirtualMachine is the client for interacting with the VirtualMachine builders.
|
|
VirtualMachine *VirtualMachineClient
|
|
}
|
|
|
|
// 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.Audit = NewAuditClient(c.config)
|
|
c.GitBot = NewGitBotClient(c.config)
|
|
c.GitBotTask = NewGitBotTaskClient(c.config)
|
|
c.GitBotUser = NewGitBotUserClient(c.config)
|
|
c.GitIdentity = NewGitIdentityClient(c.config)
|
|
c.Host = NewHostClient(c.config)
|
|
c.Image = NewImageClient(c.config)
|
|
c.Model = NewModelClient(c.config)
|
|
c.NotifyChannel = NewNotifyChannelClient(c.config)
|
|
c.NotifySendLog = NewNotifySendLogClient(c.config)
|
|
c.NotifySubscription = NewNotifySubscriptionClient(c.config)
|
|
c.Project = NewProjectClient(c.config)
|
|
c.ProjectCollaborator = NewProjectCollaboratorClient(c.config)
|
|
c.ProjectGitBot = NewProjectGitBotClient(c.config)
|
|
c.ProjectIssue = NewProjectIssueClient(c.config)
|
|
c.ProjectIssueComment = NewProjectIssueCommentClient(c.config)
|
|
c.ProjectTask = NewProjectTaskClient(c.config)
|
|
c.Task = NewTaskClient(c.config)
|
|
c.TaskVirtualMachine = NewTaskVirtualMachineClient(c.config)
|
|
c.Team = NewTeamClient(c.config)
|
|
c.TeamGroup = NewTeamGroupClient(c.config)
|
|
c.TeamGroupHost = NewTeamGroupHostClient(c.config)
|
|
c.TeamGroupImage = NewTeamGroupImageClient(c.config)
|
|
c.TeamGroupMember = NewTeamGroupMemberClient(c.config)
|
|
c.TeamGroupModel = NewTeamGroupModelClient(c.config)
|
|
c.TeamHost = NewTeamHostClient(c.config)
|
|
c.TeamImage = NewTeamImageClient(c.config)
|
|
c.TeamMember = NewTeamMemberClient(c.config)
|
|
c.TeamModel = NewTeamModelClient(c.config)
|
|
c.User = NewUserClient(c.config)
|
|
c.UserIdentity = NewUserIdentityClient(c.config)
|
|
c.VirtualMachine = NewVirtualMachineClient(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("db: 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("db: starting a transaction: %w", err)
|
|
}
|
|
cfg := c.config
|
|
cfg.driver = tx
|
|
return &Tx{
|
|
ctx: ctx,
|
|
config: cfg,
|
|
Audit: NewAuditClient(cfg),
|
|
GitBot: NewGitBotClient(cfg),
|
|
GitBotTask: NewGitBotTaskClient(cfg),
|
|
GitBotUser: NewGitBotUserClient(cfg),
|
|
GitIdentity: NewGitIdentityClient(cfg),
|
|
Host: NewHostClient(cfg),
|
|
Image: NewImageClient(cfg),
|
|
Model: NewModelClient(cfg),
|
|
NotifyChannel: NewNotifyChannelClient(cfg),
|
|
NotifySendLog: NewNotifySendLogClient(cfg),
|
|
NotifySubscription: NewNotifySubscriptionClient(cfg),
|
|
Project: NewProjectClient(cfg),
|
|
ProjectCollaborator: NewProjectCollaboratorClient(cfg),
|
|
ProjectGitBot: NewProjectGitBotClient(cfg),
|
|
ProjectIssue: NewProjectIssueClient(cfg),
|
|
ProjectIssueComment: NewProjectIssueCommentClient(cfg),
|
|
ProjectTask: NewProjectTaskClient(cfg),
|
|
Task: NewTaskClient(cfg),
|
|
TaskVirtualMachine: NewTaskVirtualMachineClient(cfg),
|
|
Team: NewTeamClient(cfg),
|
|
TeamGroup: NewTeamGroupClient(cfg),
|
|
TeamGroupHost: NewTeamGroupHostClient(cfg),
|
|
TeamGroupImage: NewTeamGroupImageClient(cfg),
|
|
TeamGroupMember: NewTeamGroupMemberClient(cfg),
|
|
TeamGroupModel: NewTeamGroupModelClient(cfg),
|
|
TeamHost: NewTeamHostClient(cfg),
|
|
TeamImage: NewTeamImageClient(cfg),
|
|
TeamMember: NewTeamMemberClient(cfg),
|
|
TeamModel: NewTeamModelClient(cfg),
|
|
User: NewUserClient(cfg),
|
|
UserIdentity: NewUserIdentityClient(cfg),
|
|
VirtualMachine: NewVirtualMachineClient(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,
|
|
Audit: NewAuditClient(cfg),
|
|
GitBot: NewGitBotClient(cfg),
|
|
GitBotTask: NewGitBotTaskClient(cfg),
|
|
GitBotUser: NewGitBotUserClient(cfg),
|
|
GitIdentity: NewGitIdentityClient(cfg),
|
|
Host: NewHostClient(cfg),
|
|
Image: NewImageClient(cfg),
|
|
Model: NewModelClient(cfg),
|
|
NotifyChannel: NewNotifyChannelClient(cfg),
|
|
NotifySendLog: NewNotifySendLogClient(cfg),
|
|
NotifySubscription: NewNotifySubscriptionClient(cfg),
|
|
Project: NewProjectClient(cfg),
|
|
ProjectCollaborator: NewProjectCollaboratorClient(cfg),
|
|
ProjectGitBot: NewProjectGitBotClient(cfg),
|
|
ProjectIssue: NewProjectIssueClient(cfg),
|
|
ProjectIssueComment: NewProjectIssueCommentClient(cfg),
|
|
ProjectTask: NewProjectTaskClient(cfg),
|
|
Task: NewTaskClient(cfg),
|
|
TaskVirtualMachine: NewTaskVirtualMachineClient(cfg),
|
|
Team: NewTeamClient(cfg),
|
|
TeamGroup: NewTeamGroupClient(cfg),
|
|
TeamGroupHost: NewTeamGroupHostClient(cfg),
|
|
TeamGroupImage: NewTeamGroupImageClient(cfg),
|
|
TeamGroupMember: NewTeamGroupMemberClient(cfg),
|
|
TeamGroupModel: NewTeamGroupModelClient(cfg),
|
|
TeamHost: NewTeamHostClient(cfg),
|
|
TeamImage: NewTeamImageClient(cfg),
|
|
TeamMember: NewTeamMemberClient(cfg),
|
|
TeamModel: NewTeamModelClient(cfg),
|
|
User: NewUserClient(cfg),
|
|
UserIdentity: NewUserIdentityClient(cfg),
|
|
VirtualMachine: NewVirtualMachineClient(cfg),
|
|
}, nil
|
|
}
|
|
|
|
// Debug returns a new debug-client. It's used to get verbose logging on specific operations.
|
|
//
|
|
// client.Debug().
|
|
// Audit.
|
|
// 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.Audit, c.GitBot, c.GitBotTask, c.GitBotUser, c.GitIdentity, c.Host, c.Image,
|
|
c.Model, c.NotifyChannel, c.NotifySendLog, c.NotifySubscription, c.Project,
|
|
c.ProjectCollaborator, c.ProjectGitBot, c.ProjectIssue, c.ProjectIssueComment,
|
|
c.ProjectTask, c.Task, c.TaskVirtualMachine, c.Team, c.TeamGroup,
|
|
c.TeamGroupHost, c.TeamGroupImage, c.TeamGroupMember, c.TeamGroupModel,
|
|
c.TeamHost, c.TeamImage, c.TeamMember, c.TeamModel, c.User, c.UserIdentity,
|
|
c.VirtualMachine,
|
|
} {
|
|
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.Audit, c.GitBot, c.GitBotTask, c.GitBotUser, c.GitIdentity, c.Host, c.Image,
|
|
c.Model, c.NotifyChannel, c.NotifySendLog, c.NotifySubscription, c.Project,
|
|
c.ProjectCollaborator, c.ProjectGitBot, c.ProjectIssue, c.ProjectIssueComment,
|
|
c.ProjectTask, c.Task, c.TaskVirtualMachine, c.Team, c.TeamGroup,
|
|
c.TeamGroupHost, c.TeamGroupImage, c.TeamGroupMember, c.TeamGroupModel,
|
|
c.TeamHost, c.TeamImage, c.TeamMember, c.TeamModel, c.User, c.UserIdentity,
|
|
c.VirtualMachine,
|
|
} {
|
|
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 *AuditMutation:
|
|
return c.Audit.mutate(ctx, m)
|
|
case *GitBotMutation:
|
|
return c.GitBot.mutate(ctx, m)
|
|
case *GitBotTaskMutation:
|
|
return c.GitBotTask.mutate(ctx, m)
|
|
case *GitBotUserMutation:
|
|
return c.GitBotUser.mutate(ctx, m)
|
|
case *GitIdentityMutation:
|
|
return c.GitIdentity.mutate(ctx, m)
|
|
case *HostMutation:
|
|
return c.Host.mutate(ctx, m)
|
|
case *ImageMutation:
|
|
return c.Image.mutate(ctx, m)
|
|
case *ModelMutation:
|
|
return c.Model.mutate(ctx, m)
|
|
case *NotifyChannelMutation:
|
|
return c.NotifyChannel.mutate(ctx, m)
|
|
case *NotifySendLogMutation:
|
|
return c.NotifySendLog.mutate(ctx, m)
|
|
case *NotifySubscriptionMutation:
|
|
return c.NotifySubscription.mutate(ctx, m)
|
|
case *ProjectMutation:
|
|
return c.Project.mutate(ctx, m)
|
|
case *ProjectCollaboratorMutation:
|
|
return c.ProjectCollaborator.mutate(ctx, m)
|
|
case *ProjectGitBotMutation:
|
|
return c.ProjectGitBot.mutate(ctx, m)
|
|
case *ProjectIssueMutation:
|
|
return c.ProjectIssue.mutate(ctx, m)
|
|
case *ProjectIssueCommentMutation:
|
|
return c.ProjectIssueComment.mutate(ctx, m)
|
|
case *ProjectTaskMutation:
|
|
return c.ProjectTask.mutate(ctx, m)
|
|
case *TaskMutation:
|
|
return c.Task.mutate(ctx, m)
|
|
case *TaskVirtualMachineMutation:
|
|
return c.TaskVirtualMachine.mutate(ctx, m)
|
|
case *TeamMutation:
|
|
return c.Team.mutate(ctx, m)
|
|
case *TeamGroupMutation:
|
|
return c.TeamGroup.mutate(ctx, m)
|
|
case *TeamGroupHostMutation:
|
|
return c.TeamGroupHost.mutate(ctx, m)
|
|
case *TeamGroupImageMutation:
|
|
return c.TeamGroupImage.mutate(ctx, m)
|
|
case *TeamGroupMemberMutation:
|
|
return c.TeamGroupMember.mutate(ctx, m)
|
|
case *TeamGroupModelMutation:
|
|
return c.TeamGroupModel.mutate(ctx, m)
|
|
case *TeamHostMutation:
|
|
return c.TeamHost.mutate(ctx, m)
|
|
case *TeamImageMutation:
|
|
return c.TeamImage.mutate(ctx, m)
|
|
case *TeamMemberMutation:
|
|
return c.TeamMember.mutate(ctx, m)
|
|
case *TeamModelMutation:
|
|
return c.TeamModel.mutate(ctx, m)
|
|
case *UserMutation:
|
|
return c.User.mutate(ctx, m)
|
|
case *UserIdentityMutation:
|
|
return c.UserIdentity.mutate(ctx, m)
|
|
case *VirtualMachineMutation:
|
|
return c.VirtualMachine.mutate(ctx, m)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown mutation type %T", m)
|
|
}
|
|
}
|
|
|
|
// AuditClient is a client for the Audit schema.
|
|
type AuditClient struct {
|
|
config
|
|
}
|
|
|
|
// NewAuditClient returns a client for the Audit from the given config.
|
|
func NewAuditClient(c config) *AuditClient {
|
|
return &AuditClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `audit.Hooks(f(g(h())))`.
|
|
func (c *AuditClient) Use(hooks ...Hook) {
|
|
c.hooks.Audit = append(c.hooks.Audit, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `audit.Intercept(f(g(h())))`.
|
|
func (c *AuditClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.Audit = append(c.inters.Audit, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a Audit entity.
|
|
func (c *AuditClient) Create() *AuditCreate {
|
|
mutation := newAuditMutation(c.config, OpCreate)
|
|
return &AuditCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of Audit entities.
|
|
func (c *AuditClient) CreateBulk(builders ...*AuditCreate) *AuditCreateBulk {
|
|
return &AuditCreateBulk{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 *AuditClient) MapCreateBulk(slice any, setFunc func(*AuditCreate, int)) *AuditCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &AuditCreateBulk{err: fmt.Errorf("calling to AuditClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*AuditCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &AuditCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for Audit.
|
|
func (c *AuditClient) Update() *AuditUpdate {
|
|
mutation := newAuditMutation(c.config, OpUpdate)
|
|
return &AuditUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *AuditClient) UpdateOne(_m *Audit) *AuditUpdateOne {
|
|
mutation := newAuditMutation(c.config, OpUpdateOne, withAudit(_m))
|
|
return &AuditUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *AuditClient) UpdateOneID(id uuid.UUID) *AuditUpdateOne {
|
|
mutation := newAuditMutation(c.config, OpUpdateOne, withAuditID(id))
|
|
return &AuditUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for Audit.
|
|
func (c *AuditClient) Delete() *AuditDelete {
|
|
mutation := newAuditMutation(c.config, OpDelete)
|
|
return &AuditDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *AuditClient) DeleteOne(_m *Audit) *AuditDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *AuditClient) DeleteOneID(id uuid.UUID) *AuditDeleteOne {
|
|
builder := c.Delete().Where(audit.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &AuditDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for Audit.
|
|
func (c *AuditClient) Query() *AuditQuery {
|
|
return &AuditQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeAudit},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a Audit entity by its id.
|
|
func (c *AuditClient) Get(ctx context.Context, id uuid.UUID) (*Audit, error) {
|
|
return c.Query().Where(audit.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *AuditClient) GetX(ctx context.Context, id uuid.UUID) *Audit {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// QueryUser queries the user edge of a Audit.
|
|
func (c *AuditClient) QueryUser(_m *Audit) *UserQuery {
|
|
query := (&UserClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(audit.Table, audit.FieldID, id),
|
|
sqlgraph.To(user.Table, user.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, audit.UserTable, audit.UserColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *AuditClient) Hooks() []Hook {
|
|
return c.hooks.Audit
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *AuditClient) Interceptors() []Interceptor {
|
|
return c.inters.Audit
|
|
}
|
|
|
|
func (c *AuditClient) mutate(ctx context.Context, m *AuditMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&AuditCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&AuditUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&AuditUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&AuditDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown Audit mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// GitBotClient is a client for the GitBot schema.
|
|
type GitBotClient struct {
|
|
config
|
|
}
|
|
|
|
// NewGitBotClient returns a client for the GitBot from the given config.
|
|
func NewGitBotClient(c config) *GitBotClient {
|
|
return &GitBotClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `gitbot.Hooks(f(g(h())))`.
|
|
func (c *GitBotClient) Use(hooks ...Hook) {
|
|
c.hooks.GitBot = append(c.hooks.GitBot, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `gitbot.Intercept(f(g(h())))`.
|
|
func (c *GitBotClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.GitBot = append(c.inters.GitBot, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a GitBot entity.
|
|
func (c *GitBotClient) Create() *GitBotCreate {
|
|
mutation := newGitBotMutation(c.config, OpCreate)
|
|
return &GitBotCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of GitBot entities.
|
|
func (c *GitBotClient) CreateBulk(builders ...*GitBotCreate) *GitBotCreateBulk {
|
|
return &GitBotCreateBulk{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 *GitBotClient) MapCreateBulk(slice any, setFunc func(*GitBotCreate, int)) *GitBotCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &GitBotCreateBulk{err: fmt.Errorf("calling to GitBotClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*GitBotCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &GitBotCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for GitBot.
|
|
func (c *GitBotClient) Update() *GitBotUpdate {
|
|
mutation := newGitBotMutation(c.config, OpUpdate)
|
|
return &GitBotUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *GitBotClient) UpdateOne(_m *GitBot) *GitBotUpdateOne {
|
|
mutation := newGitBotMutation(c.config, OpUpdateOne, withGitBot(_m))
|
|
return &GitBotUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *GitBotClient) UpdateOneID(id uuid.UUID) *GitBotUpdateOne {
|
|
mutation := newGitBotMutation(c.config, OpUpdateOne, withGitBotID(id))
|
|
return &GitBotUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for GitBot.
|
|
func (c *GitBotClient) Delete() *GitBotDelete {
|
|
mutation := newGitBotMutation(c.config, OpDelete)
|
|
return &GitBotDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *GitBotClient) DeleteOne(_m *GitBot) *GitBotDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *GitBotClient) DeleteOneID(id uuid.UUID) *GitBotDeleteOne {
|
|
builder := c.Delete().Where(gitbot.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &GitBotDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for GitBot.
|
|
func (c *GitBotClient) Query() *GitBotQuery {
|
|
return &GitBotQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeGitBot},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a GitBot entity by its id.
|
|
func (c *GitBotClient) Get(ctx context.Context, id uuid.UUID) (*GitBot, error) {
|
|
return c.Query().Where(gitbot.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *GitBotClient) GetX(ctx context.Context, id uuid.UUID) *GitBot {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// QueryGitBotTasks queries the git_bot_tasks edge of a GitBot.
|
|
func (c *GitBotClient) QueryGitBotTasks(_m *GitBot) *GitBotTaskQuery {
|
|
query := (&GitBotTaskClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(gitbot.Table, gitbot.FieldID, id),
|
|
sqlgraph.To(gitbottask.Table, gitbottask.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, gitbot.GitBotTasksTable, gitbot.GitBotTasksColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryHost queries the host edge of a GitBot.
|
|
func (c *GitBotClient) QueryHost(_m *GitBot) *HostQuery {
|
|
query := (&HostClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(gitbot.Table, gitbot.FieldID, id),
|
|
sqlgraph.To(host.Table, host.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, gitbot.HostTable, gitbot.HostColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryUsers queries the users edge of a GitBot.
|
|
func (c *GitBotClient) QueryUsers(_m *GitBot) *UserQuery {
|
|
query := (&UserClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(gitbot.Table, gitbot.FieldID, id),
|
|
sqlgraph.To(user.Table, user.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2M, true, gitbot.UsersTable, gitbot.UsersPrimaryKey...),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryProjects queries the projects edge of a GitBot.
|
|
func (c *GitBotClient) QueryProjects(_m *GitBot) *ProjectQuery {
|
|
query := (&ProjectClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(gitbot.Table, gitbot.FieldID, id),
|
|
sqlgraph.To(project.Table, project.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2M, true, gitbot.ProjectsTable, gitbot.ProjectsPrimaryKey...),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryGitBotUsers queries the git_bot_users edge of a GitBot.
|
|
func (c *GitBotClient) QueryGitBotUsers(_m *GitBot) *GitBotUserQuery {
|
|
query := (&GitBotUserClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(gitbot.Table, gitbot.FieldID, id),
|
|
sqlgraph.To(gitbotuser.Table, gitbotuser.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, true, gitbot.GitBotUsersTable, gitbot.GitBotUsersColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryProjectGitBots queries the project_git_bots edge of a GitBot.
|
|
func (c *GitBotClient) QueryProjectGitBots(_m *GitBot) *ProjectGitBotQuery {
|
|
query := (&ProjectGitBotClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(gitbot.Table, gitbot.FieldID, id),
|
|
sqlgraph.To(projectgitbot.Table, projectgitbot.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, true, gitbot.ProjectGitBotsTable, gitbot.ProjectGitBotsColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *GitBotClient) Hooks() []Hook {
|
|
hooks := c.hooks.GitBot
|
|
return append(hooks[:len(hooks):len(hooks)], gitbot.Hooks[:]...)
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *GitBotClient) Interceptors() []Interceptor {
|
|
inters := c.inters.GitBot
|
|
return append(inters[:len(inters):len(inters)], gitbot.Interceptors[:]...)
|
|
}
|
|
|
|
func (c *GitBotClient) mutate(ctx context.Context, m *GitBotMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&GitBotCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&GitBotUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&GitBotUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&GitBotDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown GitBot mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// GitBotTaskClient is a client for the GitBotTask schema.
|
|
type GitBotTaskClient struct {
|
|
config
|
|
}
|
|
|
|
// NewGitBotTaskClient returns a client for the GitBotTask from the given config.
|
|
func NewGitBotTaskClient(c config) *GitBotTaskClient {
|
|
return &GitBotTaskClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `gitbottask.Hooks(f(g(h())))`.
|
|
func (c *GitBotTaskClient) Use(hooks ...Hook) {
|
|
c.hooks.GitBotTask = append(c.hooks.GitBotTask, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `gitbottask.Intercept(f(g(h())))`.
|
|
func (c *GitBotTaskClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.GitBotTask = append(c.inters.GitBotTask, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a GitBotTask entity.
|
|
func (c *GitBotTaskClient) Create() *GitBotTaskCreate {
|
|
mutation := newGitBotTaskMutation(c.config, OpCreate)
|
|
return &GitBotTaskCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of GitBotTask entities.
|
|
func (c *GitBotTaskClient) CreateBulk(builders ...*GitBotTaskCreate) *GitBotTaskCreateBulk {
|
|
return &GitBotTaskCreateBulk{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 *GitBotTaskClient) MapCreateBulk(slice any, setFunc func(*GitBotTaskCreate, int)) *GitBotTaskCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &GitBotTaskCreateBulk{err: fmt.Errorf("calling to GitBotTaskClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*GitBotTaskCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &GitBotTaskCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for GitBotTask.
|
|
func (c *GitBotTaskClient) Update() *GitBotTaskUpdate {
|
|
mutation := newGitBotTaskMutation(c.config, OpUpdate)
|
|
return &GitBotTaskUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *GitBotTaskClient) UpdateOne(_m *GitBotTask) *GitBotTaskUpdateOne {
|
|
mutation := newGitBotTaskMutation(c.config, OpUpdateOne, withGitBotTask(_m))
|
|
return &GitBotTaskUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *GitBotTaskClient) UpdateOneID(id uuid.UUID) *GitBotTaskUpdateOne {
|
|
mutation := newGitBotTaskMutation(c.config, OpUpdateOne, withGitBotTaskID(id))
|
|
return &GitBotTaskUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for GitBotTask.
|
|
func (c *GitBotTaskClient) Delete() *GitBotTaskDelete {
|
|
mutation := newGitBotTaskMutation(c.config, OpDelete)
|
|
return &GitBotTaskDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *GitBotTaskClient) DeleteOne(_m *GitBotTask) *GitBotTaskDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *GitBotTaskClient) DeleteOneID(id uuid.UUID) *GitBotTaskDeleteOne {
|
|
builder := c.Delete().Where(gitbottask.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &GitBotTaskDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for GitBotTask.
|
|
func (c *GitBotTaskClient) Query() *GitBotTaskQuery {
|
|
return &GitBotTaskQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeGitBotTask},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a GitBotTask entity by its id.
|
|
func (c *GitBotTaskClient) Get(ctx context.Context, id uuid.UUID) (*GitBotTask, error) {
|
|
return c.Query().Where(gitbottask.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *GitBotTaskClient) GetX(ctx context.Context, id uuid.UUID) *GitBotTask {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// QueryTask queries the task edge of a GitBotTask.
|
|
func (c *GitBotTaskClient) QueryTask(_m *GitBotTask) *TaskQuery {
|
|
query := (&TaskClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(gitbottask.Table, gitbottask.FieldID, id),
|
|
sqlgraph.To(task.Table, task.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, gitbottask.TaskTable, gitbottask.TaskColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryGitBot queries the git_bot edge of a GitBotTask.
|
|
func (c *GitBotTaskClient) QueryGitBot(_m *GitBotTask) *GitBotQuery {
|
|
query := (&GitBotClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(gitbottask.Table, gitbottask.FieldID, id),
|
|
sqlgraph.To(gitbot.Table, gitbot.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, gitbottask.GitBotTable, gitbottask.GitBotColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *GitBotTaskClient) Hooks() []Hook {
|
|
return c.hooks.GitBotTask
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *GitBotTaskClient) Interceptors() []Interceptor {
|
|
return c.inters.GitBotTask
|
|
}
|
|
|
|
func (c *GitBotTaskClient) mutate(ctx context.Context, m *GitBotTaskMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&GitBotTaskCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&GitBotTaskUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&GitBotTaskUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&GitBotTaskDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown GitBotTask mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// GitBotUserClient is a client for the GitBotUser schema.
|
|
type GitBotUserClient struct {
|
|
config
|
|
}
|
|
|
|
// NewGitBotUserClient returns a client for the GitBotUser from the given config.
|
|
func NewGitBotUserClient(c config) *GitBotUserClient {
|
|
return &GitBotUserClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `gitbotuser.Hooks(f(g(h())))`.
|
|
func (c *GitBotUserClient) Use(hooks ...Hook) {
|
|
c.hooks.GitBotUser = append(c.hooks.GitBotUser, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `gitbotuser.Intercept(f(g(h())))`.
|
|
func (c *GitBotUserClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.GitBotUser = append(c.inters.GitBotUser, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a GitBotUser entity.
|
|
func (c *GitBotUserClient) Create() *GitBotUserCreate {
|
|
mutation := newGitBotUserMutation(c.config, OpCreate)
|
|
return &GitBotUserCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of GitBotUser entities.
|
|
func (c *GitBotUserClient) CreateBulk(builders ...*GitBotUserCreate) *GitBotUserCreateBulk {
|
|
return &GitBotUserCreateBulk{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 *GitBotUserClient) MapCreateBulk(slice any, setFunc func(*GitBotUserCreate, int)) *GitBotUserCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &GitBotUserCreateBulk{err: fmt.Errorf("calling to GitBotUserClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*GitBotUserCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &GitBotUserCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for GitBotUser.
|
|
func (c *GitBotUserClient) Update() *GitBotUserUpdate {
|
|
mutation := newGitBotUserMutation(c.config, OpUpdate)
|
|
return &GitBotUserUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *GitBotUserClient) UpdateOne(_m *GitBotUser) *GitBotUserUpdateOne {
|
|
mutation := newGitBotUserMutation(c.config, OpUpdateOne, withGitBotUser(_m))
|
|
return &GitBotUserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *GitBotUserClient) UpdateOneID(id uuid.UUID) *GitBotUserUpdateOne {
|
|
mutation := newGitBotUserMutation(c.config, OpUpdateOne, withGitBotUserID(id))
|
|
return &GitBotUserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for GitBotUser.
|
|
func (c *GitBotUserClient) Delete() *GitBotUserDelete {
|
|
mutation := newGitBotUserMutation(c.config, OpDelete)
|
|
return &GitBotUserDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *GitBotUserClient) DeleteOne(_m *GitBotUser) *GitBotUserDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *GitBotUserClient) DeleteOneID(id uuid.UUID) *GitBotUserDeleteOne {
|
|
builder := c.Delete().Where(gitbotuser.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &GitBotUserDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for GitBotUser.
|
|
func (c *GitBotUserClient) Query() *GitBotUserQuery {
|
|
return &GitBotUserQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeGitBotUser},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a GitBotUser entity by its id.
|
|
func (c *GitBotUserClient) Get(ctx context.Context, id uuid.UUID) (*GitBotUser, error) {
|
|
return c.Query().Where(gitbotuser.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *GitBotUserClient) GetX(ctx context.Context, id uuid.UUID) *GitBotUser {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// QueryGitBot queries the git_bot edge of a GitBotUser.
|
|
func (c *GitBotUserClient) QueryGitBot(_m *GitBotUser) *GitBotQuery {
|
|
query := (&GitBotClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(gitbotuser.Table, gitbotuser.FieldID, id),
|
|
sqlgraph.To(gitbot.Table, gitbot.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, false, gitbotuser.GitBotTable, gitbotuser.GitBotColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryUser queries the user edge of a GitBotUser.
|
|
func (c *GitBotUserClient) QueryUser(_m *GitBotUser) *UserQuery {
|
|
query := (&UserClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(gitbotuser.Table, gitbotuser.FieldID, id),
|
|
sqlgraph.To(user.Table, user.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, false, gitbotuser.UserTable, gitbotuser.UserColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *GitBotUserClient) Hooks() []Hook {
|
|
return c.hooks.GitBotUser
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *GitBotUserClient) Interceptors() []Interceptor {
|
|
return c.inters.GitBotUser
|
|
}
|
|
|
|
func (c *GitBotUserClient) mutate(ctx context.Context, m *GitBotUserMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&GitBotUserCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&GitBotUserUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&GitBotUserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&GitBotUserDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown GitBotUser mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// GitIdentityClient is a client for the GitIdentity schema.
|
|
type GitIdentityClient struct {
|
|
config
|
|
}
|
|
|
|
// NewGitIdentityClient returns a client for the GitIdentity from the given config.
|
|
func NewGitIdentityClient(c config) *GitIdentityClient {
|
|
return &GitIdentityClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `gitidentity.Hooks(f(g(h())))`.
|
|
func (c *GitIdentityClient) Use(hooks ...Hook) {
|
|
c.hooks.GitIdentity = append(c.hooks.GitIdentity, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `gitidentity.Intercept(f(g(h())))`.
|
|
func (c *GitIdentityClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.GitIdentity = append(c.inters.GitIdentity, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a GitIdentity entity.
|
|
func (c *GitIdentityClient) Create() *GitIdentityCreate {
|
|
mutation := newGitIdentityMutation(c.config, OpCreate)
|
|
return &GitIdentityCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of GitIdentity entities.
|
|
func (c *GitIdentityClient) CreateBulk(builders ...*GitIdentityCreate) *GitIdentityCreateBulk {
|
|
return &GitIdentityCreateBulk{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 *GitIdentityClient) MapCreateBulk(slice any, setFunc func(*GitIdentityCreate, int)) *GitIdentityCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &GitIdentityCreateBulk{err: fmt.Errorf("calling to GitIdentityClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*GitIdentityCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &GitIdentityCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for GitIdentity.
|
|
func (c *GitIdentityClient) Update() *GitIdentityUpdate {
|
|
mutation := newGitIdentityMutation(c.config, OpUpdate)
|
|
return &GitIdentityUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *GitIdentityClient) UpdateOne(_m *GitIdentity) *GitIdentityUpdateOne {
|
|
mutation := newGitIdentityMutation(c.config, OpUpdateOne, withGitIdentity(_m))
|
|
return &GitIdentityUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *GitIdentityClient) UpdateOneID(id uuid.UUID) *GitIdentityUpdateOne {
|
|
mutation := newGitIdentityMutation(c.config, OpUpdateOne, withGitIdentityID(id))
|
|
return &GitIdentityUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for GitIdentity.
|
|
func (c *GitIdentityClient) Delete() *GitIdentityDelete {
|
|
mutation := newGitIdentityMutation(c.config, OpDelete)
|
|
return &GitIdentityDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *GitIdentityClient) DeleteOne(_m *GitIdentity) *GitIdentityDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *GitIdentityClient) DeleteOneID(id uuid.UUID) *GitIdentityDeleteOne {
|
|
builder := c.Delete().Where(gitidentity.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &GitIdentityDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for GitIdentity.
|
|
func (c *GitIdentityClient) Query() *GitIdentityQuery {
|
|
return &GitIdentityQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeGitIdentity},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a GitIdentity entity by its id.
|
|
func (c *GitIdentityClient) Get(ctx context.Context, id uuid.UUID) (*GitIdentity, error) {
|
|
return c.Query().Where(gitidentity.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *GitIdentityClient) GetX(ctx context.Context, id uuid.UUID) *GitIdentity {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// QueryUser queries the user edge of a GitIdentity.
|
|
func (c *GitIdentityClient) QueryUser(_m *GitIdentity) *UserQuery {
|
|
query := (&UserClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(gitidentity.Table, gitidentity.FieldID, id),
|
|
sqlgraph.To(user.Table, user.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, gitidentity.UserTable, gitidentity.UserColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryProjects queries the projects edge of a GitIdentity.
|
|
func (c *GitIdentityClient) QueryProjects(_m *GitIdentity) *ProjectQuery {
|
|
query := (&ProjectClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(gitidentity.Table, gitidentity.FieldID, id),
|
|
sqlgraph.To(project.Table, project.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, gitidentity.ProjectsTable, gitidentity.ProjectsColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryProjectTasks queries the project_tasks edge of a GitIdentity.
|
|
func (c *GitIdentityClient) QueryProjectTasks(_m *GitIdentity) *ProjectTaskQuery {
|
|
query := (&ProjectTaskClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(gitidentity.Table, gitidentity.FieldID, id),
|
|
sqlgraph.To(projecttask.Table, projecttask.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, gitidentity.ProjectTasksTable, gitidentity.ProjectTasksColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *GitIdentityClient) Hooks() []Hook {
|
|
hooks := c.hooks.GitIdentity
|
|
return append(hooks[:len(hooks):len(hooks)], gitidentity.Hooks[:]...)
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *GitIdentityClient) Interceptors() []Interceptor {
|
|
inters := c.inters.GitIdentity
|
|
return append(inters[:len(inters):len(inters)], gitidentity.Interceptors[:]...)
|
|
}
|
|
|
|
func (c *GitIdentityClient) mutate(ctx context.Context, m *GitIdentityMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&GitIdentityCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&GitIdentityUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&GitIdentityUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&GitIdentityDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown GitIdentity mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// HostClient is a client for the Host schema.
|
|
type HostClient struct {
|
|
config
|
|
}
|
|
|
|
// NewHostClient returns a client for the Host from the given config.
|
|
func NewHostClient(c config) *HostClient {
|
|
return &HostClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `host.Hooks(f(g(h())))`.
|
|
func (c *HostClient) Use(hooks ...Hook) {
|
|
c.hooks.Host = append(c.hooks.Host, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `host.Intercept(f(g(h())))`.
|
|
func (c *HostClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.Host = append(c.inters.Host, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a Host entity.
|
|
func (c *HostClient) Create() *HostCreate {
|
|
mutation := newHostMutation(c.config, OpCreate)
|
|
return &HostCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of Host entities.
|
|
func (c *HostClient) CreateBulk(builders ...*HostCreate) *HostCreateBulk {
|
|
return &HostCreateBulk{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 *HostClient) MapCreateBulk(slice any, setFunc func(*HostCreate, int)) *HostCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &HostCreateBulk{err: fmt.Errorf("calling to HostClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*HostCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &HostCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for Host.
|
|
func (c *HostClient) Update() *HostUpdate {
|
|
mutation := newHostMutation(c.config, OpUpdate)
|
|
return &HostUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *HostClient) UpdateOne(_m *Host) *HostUpdateOne {
|
|
mutation := newHostMutation(c.config, OpUpdateOne, withHost(_m))
|
|
return &HostUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *HostClient) UpdateOneID(id string) *HostUpdateOne {
|
|
mutation := newHostMutation(c.config, OpUpdateOne, withHostID(id))
|
|
return &HostUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for Host.
|
|
func (c *HostClient) Delete() *HostDelete {
|
|
mutation := newHostMutation(c.config, OpDelete)
|
|
return &HostDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *HostClient) DeleteOne(_m *Host) *HostDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *HostClient) DeleteOneID(id string) *HostDeleteOne {
|
|
builder := c.Delete().Where(host.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &HostDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for Host.
|
|
func (c *HostClient) Query() *HostQuery {
|
|
return &HostQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeHost},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a Host entity by its id.
|
|
func (c *HostClient) Get(ctx context.Context, id string) (*Host, error) {
|
|
return c.Query().Where(host.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *HostClient) GetX(ctx context.Context, id string) *Host {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// QueryVms queries the vms edge of a Host.
|
|
func (c *HostClient) QueryVms(_m *Host) *VirtualMachineQuery {
|
|
query := (&VirtualMachineClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(host.Table, host.FieldID, id),
|
|
sqlgraph.To(virtualmachine.Table, virtualmachine.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, host.VmsTable, host.VmsColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryUser queries the user edge of a Host.
|
|
func (c *HostClient) QueryUser(_m *Host) *UserQuery {
|
|
query := (&UserClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(host.Table, host.FieldID, id),
|
|
sqlgraph.To(user.Table, user.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, host.UserTable, host.UserColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryGroups queries the groups edge of a Host.
|
|
func (c *HostClient) QueryGroups(_m *Host) *TeamGroupQuery {
|
|
query := (&TeamGroupClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(host.Table, host.FieldID, id),
|
|
sqlgraph.To(teamgroup.Table, teamgroup.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2M, true, host.GroupsTable, host.GroupsPrimaryKey...),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryGitBots queries the git_bots edge of a Host.
|
|
func (c *HostClient) QueryGitBots(_m *Host) *GitBotQuery {
|
|
query := (&GitBotClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(host.Table, host.FieldID, id),
|
|
sqlgraph.To(gitbot.Table, gitbot.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, host.GitBotsTable, host.GitBotsColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryTeamGroupHosts queries the team_group_hosts edge of a Host.
|
|
func (c *HostClient) QueryTeamGroupHosts(_m *Host) *TeamGroupHostQuery {
|
|
query := (&TeamGroupHostClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(host.Table, host.FieldID, id),
|
|
sqlgraph.To(teamgrouphost.Table, teamgrouphost.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, true, host.TeamGroupHostsTable, host.TeamGroupHostsColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *HostClient) Hooks() []Hook {
|
|
hooks := c.hooks.Host
|
|
return append(hooks[:len(hooks):len(hooks)], host.Hooks[:]...)
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *HostClient) Interceptors() []Interceptor {
|
|
inters := c.inters.Host
|
|
return append(inters[:len(inters):len(inters)], host.Interceptors[:]...)
|
|
}
|
|
|
|
func (c *HostClient) mutate(ctx context.Context, m *HostMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&HostCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&HostUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&HostUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&HostDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown Host mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// ImageClient is a client for the Image schema.
|
|
type ImageClient struct {
|
|
config
|
|
}
|
|
|
|
// NewImageClient returns a client for the Image from the given config.
|
|
func NewImageClient(c config) *ImageClient {
|
|
return &ImageClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `image.Hooks(f(g(h())))`.
|
|
func (c *ImageClient) Use(hooks ...Hook) {
|
|
c.hooks.Image = append(c.hooks.Image, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `image.Intercept(f(g(h())))`.
|
|
func (c *ImageClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.Image = append(c.inters.Image, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a Image entity.
|
|
func (c *ImageClient) Create() *ImageCreate {
|
|
mutation := newImageMutation(c.config, OpCreate)
|
|
return &ImageCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of Image entities.
|
|
func (c *ImageClient) CreateBulk(builders ...*ImageCreate) *ImageCreateBulk {
|
|
return &ImageCreateBulk{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 *ImageClient) MapCreateBulk(slice any, setFunc func(*ImageCreate, int)) *ImageCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &ImageCreateBulk{err: fmt.Errorf("calling to ImageClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*ImageCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &ImageCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for Image.
|
|
func (c *ImageClient) Update() *ImageUpdate {
|
|
mutation := newImageMutation(c.config, OpUpdate)
|
|
return &ImageUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *ImageClient) UpdateOne(_m *Image) *ImageUpdateOne {
|
|
mutation := newImageMutation(c.config, OpUpdateOne, withImage(_m))
|
|
return &ImageUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *ImageClient) UpdateOneID(id uuid.UUID) *ImageUpdateOne {
|
|
mutation := newImageMutation(c.config, OpUpdateOne, withImageID(id))
|
|
return &ImageUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for Image.
|
|
func (c *ImageClient) Delete() *ImageDelete {
|
|
mutation := newImageMutation(c.config, OpDelete)
|
|
return &ImageDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *ImageClient) DeleteOne(_m *Image) *ImageDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *ImageClient) DeleteOneID(id uuid.UUID) *ImageDeleteOne {
|
|
builder := c.Delete().Where(image.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &ImageDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for Image.
|
|
func (c *ImageClient) Query() *ImageQuery {
|
|
return &ImageQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeImage},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a Image entity by its id.
|
|
func (c *ImageClient) Get(ctx context.Context, id uuid.UUID) (*Image, error) {
|
|
return c.Query().Where(image.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *ImageClient) GetX(ctx context.Context, id uuid.UUID) *Image {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// QueryUser queries the user edge of a Image.
|
|
func (c *ImageClient) QueryUser(_m *Image) *UserQuery {
|
|
query := (&UserClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(image.Table, image.FieldID, id),
|
|
sqlgraph.To(user.Table, user.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, image.UserTable, image.UserColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryTeams queries the teams edge of a Image.
|
|
func (c *ImageClient) QueryTeams(_m *Image) *TeamQuery {
|
|
query := (&TeamClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(image.Table, image.FieldID, id),
|
|
sqlgraph.To(team.Table, team.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2M, true, image.TeamsTable, image.TeamsPrimaryKey...),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryGroups queries the groups edge of a Image.
|
|
func (c *ImageClient) QueryGroups(_m *Image) *TeamGroupQuery {
|
|
query := (&TeamGroupClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(image.Table, image.FieldID, id),
|
|
sqlgraph.To(teamgroup.Table, teamgroup.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2M, true, image.GroupsTable, image.GroupsPrimaryKey...),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryProjectTasks queries the project_tasks edge of a Image.
|
|
func (c *ImageClient) QueryProjectTasks(_m *Image) *ProjectTaskQuery {
|
|
query := (&ProjectTaskClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(image.Table, image.FieldID, id),
|
|
sqlgraph.To(projecttask.Table, projecttask.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, image.ProjectTasksTable, image.ProjectTasksColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryProjects queries the projects edge of a Image.
|
|
func (c *ImageClient) QueryProjects(_m *Image) *ProjectQuery {
|
|
query := (&ProjectClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(image.Table, image.FieldID, id),
|
|
sqlgraph.To(project.Table, project.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, image.ProjectsTable, image.ProjectsColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryTeamImages queries the team_images edge of a Image.
|
|
func (c *ImageClient) QueryTeamImages(_m *Image) *TeamImageQuery {
|
|
query := (&TeamImageClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(image.Table, image.FieldID, id),
|
|
sqlgraph.To(teamimage.Table, teamimage.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, true, image.TeamImagesTable, image.TeamImagesColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryTeamGroupImages queries the team_group_images edge of a Image.
|
|
func (c *ImageClient) QueryTeamGroupImages(_m *Image) *TeamGroupImageQuery {
|
|
query := (&TeamGroupImageClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(image.Table, image.FieldID, id),
|
|
sqlgraph.To(teamgroupimage.Table, teamgroupimage.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, true, image.TeamGroupImagesTable, image.TeamGroupImagesColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *ImageClient) Hooks() []Hook {
|
|
hooks := c.hooks.Image
|
|
return append(hooks[:len(hooks):len(hooks)], image.Hooks[:]...)
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *ImageClient) Interceptors() []Interceptor {
|
|
inters := c.inters.Image
|
|
return append(inters[:len(inters):len(inters)], image.Interceptors[:]...)
|
|
}
|
|
|
|
func (c *ImageClient) mutate(ctx context.Context, m *ImageMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&ImageCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&ImageUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&ImageUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&ImageDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown Image mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// ModelClient is a client for the Model schema.
|
|
type ModelClient struct {
|
|
config
|
|
}
|
|
|
|
// NewModelClient returns a client for the Model from the given config.
|
|
func NewModelClient(c config) *ModelClient {
|
|
return &ModelClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `model.Hooks(f(g(h())))`.
|
|
func (c *ModelClient) Use(hooks ...Hook) {
|
|
c.hooks.Model = append(c.hooks.Model, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `model.Intercept(f(g(h())))`.
|
|
func (c *ModelClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.Model = append(c.inters.Model, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a Model entity.
|
|
func (c *ModelClient) Create() *ModelCreate {
|
|
mutation := newModelMutation(c.config, OpCreate)
|
|
return &ModelCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of Model entities.
|
|
func (c *ModelClient) CreateBulk(builders ...*ModelCreate) *ModelCreateBulk {
|
|
return &ModelCreateBulk{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 *ModelClient) MapCreateBulk(slice any, setFunc func(*ModelCreate, int)) *ModelCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &ModelCreateBulk{err: fmt.Errorf("calling to ModelClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*ModelCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &ModelCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for Model.
|
|
func (c *ModelClient) Update() *ModelUpdate {
|
|
mutation := newModelMutation(c.config, OpUpdate)
|
|
return &ModelUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *ModelClient) UpdateOne(_m *Model) *ModelUpdateOne {
|
|
mutation := newModelMutation(c.config, OpUpdateOne, withModel(_m))
|
|
return &ModelUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *ModelClient) UpdateOneID(id uuid.UUID) *ModelUpdateOne {
|
|
mutation := newModelMutation(c.config, OpUpdateOne, withModelID(id))
|
|
return &ModelUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for Model.
|
|
func (c *ModelClient) Delete() *ModelDelete {
|
|
mutation := newModelMutation(c.config, OpDelete)
|
|
return &ModelDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *ModelClient) DeleteOne(_m *Model) *ModelDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *ModelClient) DeleteOneID(id uuid.UUID) *ModelDeleteOne {
|
|
builder := c.Delete().Where(model.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &ModelDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for Model.
|
|
func (c *ModelClient) Query() *ModelQuery {
|
|
return &ModelQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeModel},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a Model entity by its id.
|
|
func (c *ModelClient) Get(ctx context.Context, id uuid.UUID) (*Model, error) {
|
|
return c.Query().Where(model.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *ModelClient) GetX(ctx context.Context, id uuid.UUID) *Model {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// QueryUser queries the user edge of a Model.
|
|
func (c *ModelClient) QueryUser(_m *Model) *UserQuery {
|
|
query := (&UserClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(model.Table, model.FieldID, id),
|
|
sqlgraph.To(user.Table, user.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, model.UserTable, model.UserColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryTeams queries the teams edge of a Model.
|
|
func (c *ModelClient) QueryTeams(_m *Model) *TeamQuery {
|
|
query := (&TeamClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(model.Table, model.FieldID, id),
|
|
sqlgraph.To(team.Table, team.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2M, true, model.TeamsTable, model.TeamsPrimaryKey...),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryGroups queries the groups edge of a Model.
|
|
func (c *ModelClient) QueryGroups(_m *Model) *TeamGroupQuery {
|
|
query := (&TeamGroupClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(model.Table, model.FieldID, id),
|
|
sqlgraph.To(teamgroup.Table, teamgroup.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2M, true, model.GroupsTable, model.GroupsPrimaryKey...),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryVms queries the vms edge of a Model.
|
|
func (c *ModelClient) QueryVms(_m *Model) *VirtualMachineQuery {
|
|
query := (&VirtualMachineClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(model.Table, model.FieldID, id),
|
|
sqlgraph.To(virtualmachine.Table, virtualmachine.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, model.VmsTable, model.VmsColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryProjectTasks queries the project_tasks edge of a Model.
|
|
func (c *ModelClient) QueryProjectTasks(_m *Model) *ProjectTaskQuery {
|
|
query := (&ProjectTaskClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(model.Table, model.FieldID, id),
|
|
sqlgraph.To(projecttask.Table, projecttask.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, model.ProjectTasksTable, model.ProjectTasksColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryTeamModels queries the team_models edge of a Model.
|
|
func (c *ModelClient) QueryTeamModels(_m *Model) *TeamModelQuery {
|
|
query := (&TeamModelClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(model.Table, model.FieldID, id),
|
|
sqlgraph.To(teammodel.Table, teammodel.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, true, model.TeamModelsTable, model.TeamModelsColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryTeamGroupModels queries the team_group_models edge of a Model.
|
|
func (c *ModelClient) QueryTeamGroupModels(_m *Model) *TeamGroupModelQuery {
|
|
query := (&TeamGroupModelClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(model.Table, model.FieldID, id),
|
|
sqlgraph.To(teamgroupmodel.Table, teamgroupmodel.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, true, model.TeamGroupModelsTable, model.TeamGroupModelsColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *ModelClient) Hooks() []Hook {
|
|
hooks := c.hooks.Model
|
|
return append(hooks[:len(hooks):len(hooks)], model.Hooks[:]...)
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *ModelClient) Interceptors() []Interceptor {
|
|
inters := c.inters.Model
|
|
return append(inters[:len(inters):len(inters)], model.Interceptors[:]...)
|
|
}
|
|
|
|
func (c *ModelClient) mutate(ctx context.Context, m *ModelMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&ModelCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&ModelUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&ModelUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&ModelDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown Model mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// NotifyChannelClient is a client for the NotifyChannel schema.
|
|
type NotifyChannelClient struct {
|
|
config
|
|
}
|
|
|
|
// NewNotifyChannelClient returns a client for the NotifyChannel from the given config.
|
|
func NewNotifyChannelClient(c config) *NotifyChannelClient {
|
|
return &NotifyChannelClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `notifychannel.Hooks(f(g(h())))`.
|
|
func (c *NotifyChannelClient) Use(hooks ...Hook) {
|
|
c.hooks.NotifyChannel = append(c.hooks.NotifyChannel, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `notifychannel.Intercept(f(g(h())))`.
|
|
func (c *NotifyChannelClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.NotifyChannel = append(c.inters.NotifyChannel, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a NotifyChannel entity.
|
|
func (c *NotifyChannelClient) Create() *NotifyChannelCreate {
|
|
mutation := newNotifyChannelMutation(c.config, OpCreate)
|
|
return &NotifyChannelCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of NotifyChannel entities.
|
|
func (c *NotifyChannelClient) CreateBulk(builders ...*NotifyChannelCreate) *NotifyChannelCreateBulk {
|
|
return &NotifyChannelCreateBulk{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 *NotifyChannelClient) MapCreateBulk(slice any, setFunc func(*NotifyChannelCreate, int)) *NotifyChannelCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &NotifyChannelCreateBulk{err: fmt.Errorf("calling to NotifyChannelClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*NotifyChannelCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &NotifyChannelCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for NotifyChannel.
|
|
func (c *NotifyChannelClient) Update() *NotifyChannelUpdate {
|
|
mutation := newNotifyChannelMutation(c.config, OpUpdate)
|
|
return &NotifyChannelUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *NotifyChannelClient) UpdateOne(_m *NotifyChannel) *NotifyChannelUpdateOne {
|
|
mutation := newNotifyChannelMutation(c.config, OpUpdateOne, withNotifyChannel(_m))
|
|
return &NotifyChannelUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *NotifyChannelClient) UpdateOneID(id uuid.UUID) *NotifyChannelUpdateOne {
|
|
mutation := newNotifyChannelMutation(c.config, OpUpdateOne, withNotifyChannelID(id))
|
|
return &NotifyChannelUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for NotifyChannel.
|
|
func (c *NotifyChannelClient) Delete() *NotifyChannelDelete {
|
|
mutation := newNotifyChannelMutation(c.config, OpDelete)
|
|
return &NotifyChannelDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *NotifyChannelClient) DeleteOne(_m *NotifyChannel) *NotifyChannelDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *NotifyChannelClient) DeleteOneID(id uuid.UUID) *NotifyChannelDeleteOne {
|
|
builder := c.Delete().Where(notifychannel.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &NotifyChannelDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for NotifyChannel.
|
|
func (c *NotifyChannelClient) Query() *NotifyChannelQuery {
|
|
return &NotifyChannelQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeNotifyChannel},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a NotifyChannel entity by its id.
|
|
func (c *NotifyChannelClient) Get(ctx context.Context, id uuid.UUID) (*NotifyChannel, error) {
|
|
return c.Query().Where(notifychannel.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *NotifyChannelClient) GetX(ctx context.Context, id uuid.UUID) *NotifyChannel {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// QuerySubscriptions queries the subscriptions edge of a NotifyChannel.
|
|
func (c *NotifyChannelClient) QuerySubscriptions(_m *NotifyChannel) *NotifySubscriptionQuery {
|
|
query := (&NotifySubscriptionClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(notifychannel.Table, notifychannel.FieldID, id),
|
|
sqlgraph.To(notifysubscription.Table, notifysubscription.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, notifychannel.SubscriptionsTable, notifychannel.SubscriptionsColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *NotifyChannelClient) Hooks() []Hook {
|
|
hooks := c.hooks.NotifyChannel
|
|
return append(hooks[:len(hooks):len(hooks)], notifychannel.Hooks[:]...)
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *NotifyChannelClient) Interceptors() []Interceptor {
|
|
inters := c.inters.NotifyChannel
|
|
return append(inters[:len(inters):len(inters)], notifychannel.Interceptors[:]...)
|
|
}
|
|
|
|
func (c *NotifyChannelClient) mutate(ctx context.Context, m *NotifyChannelMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&NotifyChannelCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&NotifyChannelUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&NotifyChannelUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&NotifyChannelDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown NotifyChannel mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// NotifySendLogClient is a client for the NotifySendLog schema.
|
|
type NotifySendLogClient struct {
|
|
config
|
|
}
|
|
|
|
// NewNotifySendLogClient returns a client for the NotifySendLog from the given config.
|
|
func NewNotifySendLogClient(c config) *NotifySendLogClient {
|
|
return &NotifySendLogClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `notifysendlog.Hooks(f(g(h())))`.
|
|
func (c *NotifySendLogClient) Use(hooks ...Hook) {
|
|
c.hooks.NotifySendLog = append(c.hooks.NotifySendLog, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `notifysendlog.Intercept(f(g(h())))`.
|
|
func (c *NotifySendLogClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.NotifySendLog = append(c.inters.NotifySendLog, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a NotifySendLog entity.
|
|
func (c *NotifySendLogClient) Create() *NotifySendLogCreate {
|
|
mutation := newNotifySendLogMutation(c.config, OpCreate)
|
|
return &NotifySendLogCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of NotifySendLog entities.
|
|
func (c *NotifySendLogClient) CreateBulk(builders ...*NotifySendLogCreate) *NotifySendLogCreateBulk {
|
|
return &NotifySendLogCreateBulk{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 *NotifySendLogClient) MapCreateBulk(slice any, setFunc func(*NotifySendLogCreate, int)) *NotifySendLogCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &NotifySendLogCreateBulk{err: fmt.Errorf("calling to NotifySendLogClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*NotifySendLogCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &NotifySendLogCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for NotifySendLog.
|
|
func (c *NotifySendLogClient) Update() *NotifySendLogUpdate {
|
|
mutation := newNotifySendLogMutation(c.config, OpUpdate)
|
|
return &NotifySendLogUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *NotifySendLogClient) UpdateOne(_m *NotifySendLog) *NotifySendLogUpdateOne {
|
|
mutation := newNotifySendLogMutation(c.config, OpUpdateOne, withNotifySendLog(_m))
|
|
return &NotifySendLogUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *NotifySendLogClient) UpdateOneID(id uuid.UUID) *NotifySendLogUpdateOne {
|
|
mutation := newNotifySendLogMutation(c.config, OpUpdateOne, withNotifySendLogID(id))
|
|
return &NotifySendLogUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for NotifySendLog.
|
|
func (c *NotifySendLogClient) Delete() *NotifySendLogDelete {
|
|
mutation := newNotifySendLogMutation(c.config, OpDelete)
|
|
return &NotifySendLogDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *NotifySendLogClient) DeleteOne(_m *NotifySendLog) *NotifySendLogDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *NotifySendLogClient) DeleteOneID(id uuid.UUID) *NotifySendLogDeleteOne {
|
|
builder := c.Delete().Where(notifysendlog.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &NotifySendLogDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for NotifySendLog.
|
|
func (c *NotifySendLogClient) Query() *NotifySendLogQuery {
|
|
return &NotifySendLogQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeNotifySendLog},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a NotifySendLog entity by its id.
|
|
func (c *NotifySendLogClient) Get(ctx context.Context, id uuid.UUID) (*NotifySendLog, error) {
|
|
return c.Query().Where(notifysendlog.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *NotifySendLogClient) GetX(ctx context.Context, id uuid.UUID) *NotifySendLog {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *NotifySendLogClient) Hooks() []Hook {
|
|
return c.hooks.NotifySendLog
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *NotifySendLogClient) Interceptors() []Interceptor {
|
|
return c.inters.NotifySendLog
|
|
}
|
|
|
|
func (c *NotifySendLogClient) mutate(ctx context.Context, m *NotifySendLogMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&NotifySendLogCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&NotifySendLogUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&NotifySendLogUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&NotifySendLogDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown NotifySendLog mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// NotifySubscriptionClient is a client for the NotifySubscription schema.
|
|
type NotifySubscriptionClient struct {
|
|
config
|
|
}
|
|
|
|
// NewNotifySubscriptionClient returns a client for the NotifySubscription from the given config.
|
|
func NewNotifySubscriptionClient(c config) *NotifySubscriptionClient {
|
|
return &NotifySubscriptionClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `notifysubscription.Hooks(f(g(h())))`.
|
|
func (c *NotifySubscriptionClient) Use(hooks ...Hook) {
|
|
c.hooks.NotifySubscription = append(c.hooks.NotifySubscription, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `notifysubscription.Intercept(f(g(h())))`.
|
|
func (c *NotifySubscriptionClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.NotifySubscription = append(c.inters.NotifySubscription, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a NotifySubscription entity.
|
|
func (c *NotifySubscriptionClient) Create() *NotifySubscriptionCreate {
|
|
mutation := newNotifySubscriptionMutation(c.config, OpCreate)
|
|
return &NotifySubscriptionCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of NotifySubscription entities.
|
|
func (c *NotifySubscriptionClient) CreateBulk(builders ...*NotifySubscriptionCreate) *NotifySubscriptionCreateBulk {
|
|
return &NotifySubscriptionCreateBulk{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 *NotifySubscriptionClient) MapCreateBulk(slice any, setFunc func(*NotifySubscriptionCreate, int)) *NotifySubscriptionCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &NotifySubscriptionCreateBulk{err: fmt.Errorf("calling to NotifySubscriptionClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*NotifySubscriptionCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &NotifySubscriptionCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for NotifySubscription.
|
|
func (c *NotifySubscriptionClient) Update() *NotifySubscriptionUpdate {
|
|
mutation := newNotifySubscriptionMutation(c.config, OpUpdate)
|
|
return &NotifySubscriptionUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *NotifySubscriptionClient) UpdateOne(_m *NotifySubscription) *NotifySubscriptionUpdateOne {
|
|
mutation := newNotifySubscriptionMutation(c.config, OpUpdateOne, withNotifySubscription(_m))
|
|
return &NotifySubscriptionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *NotifySubscriptionClient) UpdateOneID(id uuid.UUID) *NotifySubscriptionUpdateOne {
|
|
mutation := newNotifySubscriptionMutation(c.config, OpUpdateOne, withNotifySubscriptionID(id))
|
|
return &NotifySubscriptionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for NotifySubscription.
|
|
func (c *NotifySubscriptionClient) Delete() *NotifySubscriptionDelete {
|
|
mutation := newNotifySubscriptionMutation(c.config, OpDelete)
|
|
return &NotifySubscriptionDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *NotifySubscriptionClient) DeleteOne(_m *NotifySubscription) *NotifySubscriptionDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *NotifySubscriptionClient) DeleteOneID(id uuid.UUID) *NotifySubscriptionDeleteOne {
|
|
builder := c.Delete().Where(notifysubscription.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &NotifySubscriptionDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for NotifySubscription.
|
|
func (c *NotifySubscriptionClient) Query() *NotifySubscriptionQuery {
|
|
return &NotifySubscriptionQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeNotifySubscription},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a NotifySubscription entity by its id.
|
|
func (c *NotifySubscriptionClient) Get(ctx context.Context, id uuid.UUID) (*NotifySubscription, error) {
|
|
return c.Query().Where(notifysubscription.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *NotifySubscriptionClient) GetX(ctx context.Context, id uuid.UUID) *NotifySubscription {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// QueryChannel queries the channel edge of a NotifySubscription.
|
|
func (c *NotifySubscriptionClient) QueryChannel(_m *NotifySubscription) *NotifyChannelQuery {
|
|
query := (&NotifyChannelClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(notifysubscription.Table, notifysubscription.FieldID, id),
|
|
sqlgraph.To(notifychannel.Table, notifychannel.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, notifysubscription.ChannelTable, notifysubscription.ChannelColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *NotifySubscriptionClient) Hooks() []Hook {
|
|
hooks := c.hooks.NotifySubscription
|
|
return append(hooks[:len(hooks):len(hooks)], notifysubscription.Hooks[:]...)
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *NotifySubscriptionClient) Interceptors() []Interceptor {
|
|
inters := c.inters.NotifySubscription
|
|
return append(inters[:len(inters):len(inters)], notifysubscription.Interceptors[:]...)
|
|
}
|
|
|
|
func (c *NotifySubscriptionClient) mutate(ctx context.Context, m *NotifySubscriptionMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&NotifySubscriptionCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&NotifySubscriptionUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&NotifySubscriptionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&NotifySubscriptionDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown NotifySubscription mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// ProjectClient is a client for the Project schema.
|
|
type ProjectClient struct {
|
|
config
|
|
}
|
|
|
|
// NewProjectClient returns a client for the Project from the given config.
|
|
func NewProjectClient(c config) *ProjectClient {
|
|
return &ProjectClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `project.Hooks(f(g(h())))`.
|
|
func (c *ProjectClient) Use(hooks ...Hook) {
|
|
c.hooks.Project = append(c.hooks.Project, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `project.Intercept(f(g(h())))`.
|
|
func (c *ProjectClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.Project = append(c.inters.Project, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a Project entity.
|
|
func (c *ProjectClient) Create() *ProjectCreate {
|
|
mutation := newProjectMutation(c.config, OpCreate)
|
|
return &ProjectCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of Project entities.
|
|
func (c *ProjectClient) CreateBulk(builders ...*ProjectCreate) *ProjectCreateBulk {
|
|
return &ProjectCreateBulk{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 *ProjectClient) MapCreateBulk(slice any, setFunc func(*ProjectCreate, int)) *ProjectCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &ProjectCreateBulk{err: fmt.Errorf("calling to ProjectClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*ProjectCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &ProjectCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for Project.
|
|
func (c *ProjectClient) Update() *ProjectUpdate {
|
|
mutation := newProjectMutation(c.config, OpUpdate)
|
|
return &ProjectUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *ProjectClient) UpdateOne(_m *Project) *ProjectUpdateOne {
|
|
mutation := newProjectMutation(c.config, OpUpdateOne, withProject(_m))
|
|
return &ProjectUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *ProjectClient) UpdateOneID(id uuid.UUID) *ProjectUpdateOne {
|
|
mutation := newProjectMutation(c.config, OpUpdateOne, withProjectID(id))
|
|
return &ProjectUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for Project.
|
|
func (c *ProjectClient) Delete() *ProjectDelete {
|
|
mutation := newProjectMutation(c.config, OpDelete)
|
|
return &ProjectDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *ProjectClient) DeleteOne(_m *Project) *ProjectDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *ProjectClient) DeleteOneID(id uuid.UUID) *ProjectDeleteOne {
|
|
builder := c.Delete().Where(project.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &ProjectDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for Project.
|
|
func (c *ProjectClient) Query() *ProjectQuery {
|
|
return &ProjectQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeProject},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a Project entity by its id.
|
|
func (c *ProjectClient) Get(ctx context.Context, id uuid.UUID) (*Project, error) {
|
|
return c.Query().Where(project.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *ProjectClient) GetX(ctx context.Context, id uuid.UUID) *Project {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// QueryUser queries the user edge of a Project.
|
|
func (c *ProjectClient) QueryUser(_m *Project) *UserQuery {
|
|
query := (&UserClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(project.Table, project.FieldID, id),
|
|
sqlgraph.To(user.Table, user.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, project.UserTable, project.UserColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryGitIdentity queries the git_identity edge of a Project.
|
|
func (c *ProjectClient) QueryGitIdentity(_m *Project) *GitIdentityQuery {
|
|
query := (&GitIdentityClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(project.Table, project.FieldID, id),
|
|
sqlgraph.To(gitidentity.Table, gitidentity.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, project.GitIdentityTable, project.GitIdentityColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryImage queries the image edge of a Project.
|
|
func (c *ProjectClient) QueryImage(_m *Project) *ImageQuery {
|
|
query := (&ImageClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(project.Table, project.FieldID, id),
|
|
sqlgraph.To(image.Table, image.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, project.ImageTable, project.ImageColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryIssues queries the issues edge of a Project.
|
|
func (c *ProjectClient) QueryIssues(_m *Project) *ProjectIssueQuery {
|
|
query := (&ProjectIssueClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(project.Table, project.FieldID, id),
|
|
sqlgraph.To(projectissue.Table, projectissue.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, project.IssuesTable, project.IssuesColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryCollaborators queries the collaborators edge of a Project.
|
|
func (c *ProjectClient) QueryCollaborators(_m *Project) *ProjectCollaboratorQuery {
|
|
query := (&ProjectCollaboratorClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(project.Table, project.FieldID, id),
|
|
sqlgraph.To(projectcollaborator.Table, projectcollaborator.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, project.CollaboratorsTable, project.CollaboratorsColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryProjectTasks queries the project_tasks edge of a Project.
|
|
func (c *ProjectClient) QueryProjectTasks(_m *Project) *ProjectTaskQuery {
|
|
query := (&ProjectTaskClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(project.Table, project.FieldID, id),
|
|
sqlgraph.To(projecttask.Table, projecttask.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, project.ProjectTasksTable, project.ProjectTasksColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryGitBots queries the git_bots edge of a Project.
|
|
func (c *ProjectClient) QueryGitBots(_m *Project) *GitBotQuery {
|
|
query := (&GitBotClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(project.Table, project.FieldID, id),
|
|
sqlgraph.To(gitbot.Table, gitbot.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2M, false, project.GitBotsTable, project.GitBotsPrimaryKey...),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryProjectGitBots queries the project_git_bots edge of a Project.
|
|
func (c *ProjectClient) QueryProjectGitBots(_m *Project) *ProjectGitBotQuery {
|
|
query := (&ProjectGitBotClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(project.Table, project.FieldID, id),
|
|
sqlgraph.To(projectgitbot.Table, projectgitbot.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, true, project.ProjectGitBotsTable, project.ProjectGitBotsColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *ProjectClient) Hooks() []Hook {
|
|
hooks := c.hooks.Project
|
|
return append(hooks[:len(hooks):len(hooks)], project.Hooks[:]...)
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *ProjectClient) Interceptors() []Interceptor {
|
|
inters := c.inters.Project
|
|
return append(inters[:len(inters):len(inters)], project.Interceptors[:]...)
|
|
}
|
|
|
|
func (c *ProjectClient) mutate(ctx context.Context, m *ProjectMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&ProjectCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&ProjectUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&ProjectUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&ProjectDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown Project mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// ProjectCollaboratorClient is a client for the ProjectCollaborator schema.
|
|
type ProjectCollaboratorClient struct {
|
|
config
|
|
}
|
|
|
|
// NewProjectCollaboratorClient returns a client for the ProjectCollaborator from the given config.
|
|
func NewProjectCollaboratorClient(c config) *ProjectCollaboratorClient {
|
|
return &ProjectCollaboratorClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `projectcollaborator.Hooks(f(g(h())))`.
|
|
func (c *ProjectCollaboratorClient) Use(hooks ...Hook) {
|
|
c.hooks.ProjectCollaborator = append(c.hooks.ProjectCollaborator, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `projectcollaborator.Intercept(f(g(h())))`.
|
|
func (c *ProjectCollaboratorClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.ProjectCollaborator = append(c.inters.ProjectCollaborator, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a ProjectCollaborator entity.
|
|
func (c *ProjectCollaboratorClient) Create() *ProjectCollaboratorCreate {
|
|
mutation := newProjectCollaboratorMutation(c.config, OpCreate)
|
|
return &ProjectCollaboratorCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of ProjectCollaborator entities.
|
|
func (c *ProjectCollaboratorClient) CreateBulk(builders ...*ProjectCollaboratorCreate) *ProjectCollaboratorCreateBulk {
|
|
return &ProjectCollaboratorCreateBulk{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 *ProjectCollaboratorClient) MapCreateBulk(slice any, setFunc func(*ProjectCollaboratorCreate, int)) *ProjectCollaboratorCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &ProjectCollaboratorCreateBulk{err: fmt.Errorf("calling to ProjectCollaboratorClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*ProjectCollaboratorCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &ProjectCollaboratorCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for ProjectCollaborator.
|
|
func (c *ProjectCollaboratorClient) Update() *ProjectCollaboratorUpdate {
|
|
mutation := newProjectCollaboratorMutation(c.config, OpUpdate)
|
|
return &ProjectCollaboratorUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *ProjectCollaboratorClient) UpdateOne(_m *ProjectCollaborator) *ProjectCollaboratorUpdateOne {
|
|
mutation := newProjectCollaboratorMutation(c.config, OpUpdateOne, withProjectCollaborator(_m))
|
|
return &ProjectCollaboratorUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *ProjectCollaboratorClient) UpdateOneID(id uuid.UUID) *ProjectCollaboratorUpdateOne {
|
|
mutation := newProjectCollaboratorMutation(c.config, OpUpdateOne, withProjectCollaboratorID(id))
|
|
return &ProjectCollaboratorUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for ProjectCollaborator.
|
|
func (c *ProjectCollaboratorClient) Delete() *ProjectCollaboratorDelete {
|
|
mutation := newProjectCollaboratorMutation(c.config, OpDelete)
|
|
return &ProjectCollaboratorDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *ProjectCollaboratorClient) DeleteOne(_m *ProjectCollaborator) *ProjectCollaboratorDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *ProjectCollaboratorClient) DeleteOneID(id uuid.UUID) *ProjectCollaboratorDeleteOne {
|
|
builder := c.Delete().Where(projectcollaborator.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &ProjectCollaboratorDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for ProjectCollaborator.
|
|
func (c *ProjectCollaboratorClient) Query() *ProjectCollaboratorQuery {
|
|
return &ProjectCollaboratorQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeProjectCollaborator},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a ProjectCollaborator entity by its id.
|
|
func (c *ProjectCollaboratorClient) Get(ctx context.Context, id uuid.UUID) (*ProjectCollaborator, error) {
|
|
return c.Query().Where(projectcollaborator.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *ProjectCollaboratorClient) GetX(ctx context.Context, id uuid.UUID) *ProjectCollaborator {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// QueryUser queries the user edge of a ProjectCollaborator.
|
|
func (c *ProjectCollaboratorClient) QueryUser(_m *ProjectCollaborator) *UserQuery {
|
|
query := (&UserClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(projectcollaborator.Table, projectcollaborator.FieldID, id),
|
|
sqlgraph.To(user.Table, user.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, projectcollaborator.UserTable, projectcollaborator.UserColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryProject queries the project edge of a ProjectCollaborator.
|
|
func (c *ProjectCollaboratorClient) QueryProject(_m *ProjectCollaborator) *ProjectQuery {
|
|
query := (&ProjectClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(projectcollaborator.Table, projectcollaborator.FieldID, id),
|
|
sqlgraph.To(project.Table, project.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, projectcollaborator.ProjectTable, projectcollaborator.ProjectColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *ProjectCollaboratorClient) Hooks() []Hook {
|
|
hooks := c.hooks.ProjectCollaborator
|
|
return append(hooks[:len(hooks):len(hooks)], projectcollaborator.Hooks[:]...)
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *ProjectCollaboratorClient) Interceptors() []Interceptor {
|
|
inters := c.inters.ProjectCollaborator
|
|
return append(inters[:len(inters):len(inters)], projectcollaborator.Interceptors[:]...)
|
|
}
|
|
|
|
func (c *ProjectCollaboratorClient) mutate(ctx context.Context, m *ProjectCollaboratorMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&ProjectCollaboratorCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&ProjectCollaboratorUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&ProjectCollaboratorUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&ProjectCollaboratorDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown ProjectCollaborator mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// ProjectGitBotClient is a client for the ProjectGitBot schema.
|
|
type ProjectGitBotClient struct {
|
|
config
|
|
}
|
|
|
|
// NewProjectGitBotClient returns a client for the ProjectGitBot from the given config.
|
|
func NewProjectGitBotClient(c config) *ProjectGitBotClient {
|
|
return &ProjectGitBotClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `projectgitbot.Hooks(f(g(h())))`.
|
|
func (c *ProjectGitBotClient) Use(hooks ...Hook) {
|
|
c.hooks.ProjectGitBot = append(c.hooks.ProjectGitBot, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `projectgitbot.Intercept(f(g(h())))`.
|
|
func (c *ProjectGitBotClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.ProjectGitBot = append(c.inters.ProjectGitBot, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a ProjectGitBot entity.
|
|
func (c *ProjectGitBotClient) Create() *ProjectGitBotCreate {
|
|
mutation := newProjectGitBotMutation(c.config, OpCreate)
|
|
return &ProjectGitBotCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of ProjectGitBot entities.
|
|
func (c *ProjectGitBotClient) CreateBulk(builders ...*ProjectGitBotCreate) *ProjectGitBotCreateBulk {
|
|
return &ProjectGitBotCreateBulk{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 *ProjectGitBotClient) MapCreateBulk(slice any, setFunc func(*ProjectGitBotCreate, int)) *ProjectGitBotCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &ProjectGitBotCreateBulk{err: fmt.Errorf("calling to ProjectGitBotClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*ProjectGitBotCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &ProjectGitBotCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for ProjectGitBot.
|
|
func (c *ProjectGitBotClient) Update() *ProjectGitBotUpdate {
|
|
mutation := newProjectGitBotMutation(c.config, OpUpdate)
|
|
return &ProjectGitBotUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *ProjectGitBotClient) UpdateOne(_m *ProjectGitBot) *ProjectGitBotUpdateOne {
|
|
mutation := newProjectGitBotMutation(c.config, OpUpdateOne, withProjectGitBot(_m))
|
|
return &ProjectGitBotUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *ProjectGitBotClient) UpdateOneID(id uuid.UUID) *ProjectGitBotUpdateOne {
|
|
mutation := newProjectGitBotMutation(c.config, OpUpdateOne, withProjectGitBotID(id))
|
|
return &ProjectGitBotUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for ProjectGitBot.
|
|
func (c *ProjectGitBotClient) Delete() *ProjectGitBotDelete {
|
|
mutation := newProjectGitBotMutation(c.config, OpDelete)
|
|
return &ProjectGitBotDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *ProjectGitBotClient) DeleteOne(_m *ProjectGitBot) *ProjectGitBotDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *ProjectGitBotClient) DeleteOneID(id uuid.UUID) *ProjectGitBotDeleteOne {
|
|
builder := c.Delete().Where(projectgitbot.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &ProjectGitBotDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for ProjectGitBot.
|
|
func (c *ProjectGitBotClient) Query() *ProjectGitBotQuery {
|
|
return &ProjectGitBotQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeProjectGitBot},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a ProjectGitBot entity by its id.
|
|
func (c *ProjectGitBotClient) Get(ctx context.Context, id uuid.UUID) (*ProjectGitBot, error) {
|
|
return c.Query().Where(projectgitbot.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *ProjectGitBotClient) GetX(ctx context.Context, id uuid.UUID) *ProjectGitBot {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// QueryProject queries the project edge of a ProjectGitBot.
|
|
func (c *ProjectGitBotClient) QueryProject(_m *ProjectGitBot) *ProjectQuery {
|
|
query := (&ProjectClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(projectgitbot.Table, projectgitbot.FieldID, id),
|
|
sqlgraph.To(project.Table, project.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, false, projectgitbot.ProjectTable, projectgitbot.ProjectColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryGitBot queries the git_bot edge of a ProjectGitBot.
|
|
func (c *ProjectGitBotClient) QueryGitBot(_m *ProjectGitBot) *GitBotQuery {
|
|
query := (&GitBotClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(projectgitbot.Table, projectgitbot.FieldID, id),
|
|
sqlgraph.To(gitbot.Table, gitbot.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, false, projectgitbot.GitBotTable, projectgitbot.GitBotColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *ProjectGitBotClient) Hooks() []Hook {
|
|
return c.hooks.ProjectGitBot
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *ProjectGitBotClient) Interceptors() []Interceptor {
|
|
return c.inters.ProjectGitBot
|
|
}
|
|
|
|
func (c *ProjectGitBotClient) mutate(ctx context.Context, m *ProjectGitBotMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&ProjectGitBotCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&ProjectGitBotUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&ProjectGitBotUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&ProjectGitBotDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown ProjectGitBot mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// ProjectIssueClient is a client for the ProjectIssue schema.
|
|
type ProjectIssueClient struct {
|
|
config
|
|
}
|
|
|
|
// NewProjectIssueClient returns a client for the ProjectIssue from the given config.
|
|
func NewProjectIssueClient(c config) *ProjectIssueClient {
|
|
return &ProjectIssueClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `projectissue.Hooks(f(g(h())))`.
|
|
func (c *ProjectIssueClient) Use(hooks ...Hook) {
|
|
c.hooks.ProjectIssue = append(c.hooks.ProjectIssue, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `projectissue.Intercept(f(g(h())))`.
|
|
func (c *ProjectIssueClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.ProjectIssue = append(c.inters.ProjectIssue, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a ProjectIssue entity.
|
|
func (c *ProjectIssueClient) Create() *ProjectIssueCreate {
|
|
mutation := newProjectIssueMutation(c.config, OpCreate)
|
|
return &ProjectIssueCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of ProjectIssue entities.
|
|
func (c *ProjectIssueClient) CreateBulk(builders ...*ProjectIssueCreate) *ProjectIssueCreateBulk {
|
|
return &ProjectIssueCreateBulk{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 *ProjectIssueClient) MapCreateBulk(slice any, setFunc func(*ProjectIssueCreate, int)) *ProjectIssueCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &ProjectIssueCreateBulk{err: fmt.Errorf("calling to ProjectIssueClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*ProjectIssueCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &ProjectIssueCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for ProjectIssue.
|
|
func (c *ProjectIssueClient) Update() *ProjectIssueUpdate {
|
|
mutation := newProjectIssueMutation(c.config, OpUpdate)
|
|
return &ProjectIssueUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *ProjectIssueClient) UpdateOne(_m *ProjectIssue) *ProjectIssueUpdateOne {
|
|
mutation := newProjectIssueMutation(c.config, OpUpdateOne, withProjectIssue(_m))
|
|
return &ProjectIssueUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *ProjectIssueClient) UpdateOneID(id uuid.UUID) *ProjectIssueUpdateOne {
|
|
mutation := newProjectIssueMutation(c.config, OpUpdateOne, withProjectIssueID(id))
|
|
return &ProjectIssueUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for ProjectIssue.
|
|
func (c *ProjectIssueClient) Delete() *ProjectIssueDelete {
|
|
mutation := newProjectIssueMutation(c.config, OpDelete)
|
|
return &ProjectIssueDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *ProjectIssueClient) DeleteOne(_m *ProjectIssue) *ProjectIssueDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *ProjectIssueClient) DeleteOneID(id uuid.UUID) *ProjectIssueDeleteOne {
|
|
builder := c.Delete().Where(projectissue.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &ProjectIssueDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for ProjectIssue.
|
|
func (c *ProjectIssueClient) Query() *ProjectIssueQuery {
|
|
return &ProjectIssueQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeProjectIssue},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a ProjectIssue entity by its id.
|
|
func (c *ProjectIssueClient) Get(ctx context.Context, id uuid.UUID) (*ProjectIssue, error) {
|
|
return c.Query().Where(projectissue.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *ProjectIssueClient) GetX(ctx context.Context, id uuid.UUID) *ProjectIssue {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// QueryUser queries the user edge of a ProjectIssue.
|
|
func (c *ProjectIssueClient) QueryUser(_m *ProjectIssue) *UserQuery {
|
|
query := (&UserClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(projectissue.Table, projectissue.FieldID, id),
|
|
sqlgraph.To(user.Table, user.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, projectissue.UserTable, projectissue.UserColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryAssignee queries the assignee edge of a ProjectIssue.
|
|
func (c *ProjectIssueClient) QueryAssignee(_m *ProjectIssue) *UserQuery {
|
|
query := (&UserClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(projectissue.Table, projectissue.FieldID, id),
|
|
sqlgraph.To(user.Table, user.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, projectissue.AssigneeTable, projectissue.AssigneeColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryProject queries the project edge of a ProjectIssue.
|
|
func (c *ProjectIssueClient) QueryProject(_m *ProjectIssue) *ProjectQuery {
|
|
query := (&ProjectClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(projectissue.Table, projectissue.FieldID, id),
|
|
sqlgraph.To(project.Table, project.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, projectissue.ProjectTable, projectissue.ProjectColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryComments queries the comments edge of a ProjectIssue.
|
|
func (c *ProjectIssueClient) QueryComments(_m *ProjectIssue) *ProjectIssueCommentQuery {
|
|
query := (&ProjectIssueCommentClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(projectissue.Table, projectissue.FieldID, id),
|
|
sqlgraph.To(projectissuecomment.Table, projectissuecomment.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, projectissue.CommentsTable, projectissue.CommentsColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryProjectTasks queries the project_tasks edge of a ProjectIssue.
|
|
func (c *ProjectIssueClient) QueryProjectTasks(_m *ProjectIssue) *ProjectTaskQuery {
|
|
query := (&ProjectTaskClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(projectissue.Table, projectissue.FieldID, id),
|
|
sqlgraph.To(projecttask.Table, projecttask.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, projectissue.ProjectTasksTable, projectissue.ProjectTasksColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *ProjectIssueClient) Hooks() []Hook {
|
|
hooks := c.hooks.ProjectIssue
|
|
return append(hooks[:len(hooks):len(hooks)], projectissue.Hooks[:]...)
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *ProjectIssueClient) Interceptors() []Interceptor {
|
|
inters := c.inters.ProjectIssue
|
|
return append(inters[:len(inters):len(inters)], projectissue.Interceptors[:]...)
|
|
}
|
|
|
|
func (c *ProjectIssueClient) mutate(ctx context.Context, m *ProjectIssueMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&ProjectIssueCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&ProjectIssueUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&ProjectIssueUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&ProjectIssueDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown ProjectIssue mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// ProjectIssueCommentClient is a client for the ProjectIssueComment schema.
|
|
type ProjectIssueCommentClient struct {
|
|
config
|
|
}
|
|
|
|
// NewProjectIssueCommentClient returns a client for the ProjectIssueComment from the given config.
|
|
func NewProjectIssueCommentClient(c config) *ProjectIssueCommentClient {
|
|
return &ProjectIssueCommentClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `projectissuecomment.Hooks(f(g(h())))`.
|
|
func (c *ProjectIssueCommentClient) Use(hooks ...Hook) {
|
|
c.hooks.ProjectIssueComment = append(c.hooks.ProjectIssueComment, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `projectissuecomment.Intercept(f(g(h())))`.
|
|
func (c *ProjectIssueCommentClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.ProjectIssueComment = append(c.inters.ProjectIssueComment, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a ProjectIssueComment entity.
|
|
func (c *ProjectIssueCommentClient) Create() *ProjectIssueCommentCreate {
|
|
mutation := newProjectIssueCommentMutation(c.config, OpCreate)
|
|
return &ProjectIssueCommentCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of ProjectIssueComment entities.
|
|
func (c *ProjectIssueCommentClient) CreateBulk(builders ...*ProjectIssueCommentCreate) *ProjectIssueCommentCreateBulk {
|
|
return &ProjectIssueCommentCreateBulk{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 *ProjectIssueCommentClient) MapCreateBulk(slice any, setFunc func(*ProjectIssueCommentCreate, int)) *ProjectIssueCommentCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &ProjectIssueCommentCreateBulk{err: fmt.Errorf("calling to ProjectIssueCommentClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*ProjectIssueCommentCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &ProjectIssueCommentCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for ProjectIssueComment.
|
|
func (c *ProjectIssueCommentClient) Update() *ProjectIssueCommentUpdate {
|
|
mutation := newProjectIssueCommentMutation(c.config, OpUpdate)
|
|
return &ProjectIssueCommentUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *ProjectIssueCommentClient) UpdateOne(_m *ProjectIssueComment) *ProjectIssueCommentUpdateOne {
|
|
mutation := newProjectIssueCommentMutation(c.config, OpUpdateOne, withProjectIssueComment(_m))
|
|
return &ProjectIssueCommentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *ProjectIssueCommentClient) UpdateOneID(id uuid.UUID) *ProjectIssueCommentUpdateOne {
|
|
mutation := newProjectIssueCommentMutation(c.config, OpUpdateOne, withProjectIssueCommentID(id))
|
|
return &ProjectIssueCommentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for ProjectIssueComment.
|
|
func (c *ProjectIssueCommentClient) Delete() *ProjectIssueCommentDelete {
|
|
mutation := newProjectIssueCommentMutation(c.config, OpDelete)
|
|
return &ProjectIssueCommentDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *ProjectIssueCommentClient) DeleteOne(_m *ProjectIssueComment) *ProjectIssueCommentDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *ProjectIssueCommentClient) DeleteOneID(id uuid.UUID) *ProjectIssueCommentDeleteOne {
|
|
builder := c.Delete().Where(projectissuecomment.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &ProjectIssueCommentDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for ProjectIssueComment.
|
|
func (c *ProjectIssueCommentClient) Query() *ProjectIssueCommentQuery {
|
|
return &ProjectIssueCommentQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeProjectIssueComment},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a ProjectIssueComment entity by its id.
|
|
func (c *ProjectIssueCommentClient) Get(ctx context.Context, id uuid.UUID) (*ProjectIssueComment, error) {
|
|
return c.Query().Where(projectissuecomment.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *ProjectIssueCommentClient) GetX(ctx context.Context, id uuid.UUID) *ProjectIssueComment {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// QueryUser queries the user edge of a ProjectIssueComment.
|
|
func (c *ProjectIssueCommentClient) QueryUser(_m *ProjectIssueComment) *UserQuery {
|
|
query := (&UserClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(projectissuecomment.Table, projectissuecomment.FieldID, id),
|
|
sqlgraph.To(user.Table, user.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, projectissuecomment.UserTable, projectissuecomment.UserColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryIssue queries the issue edge of a ProjectIssueComment.
|
|
func (c *ProjectIssueCommentClient) QueryIssue(_m *ProjectIssueComment) *ProjectIssueQuery {
|
|
query := (&ProjectIssueClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(projectissuecomment.Table, projectissuecomment.FieldID, id),
|
|
sqlgraph.To(projectissue.Table, projectissue.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, projectissuecomment.IssueTable, projectissuecomment.IssueColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryParent queries the parent edge of a ProjectIssueComment.
|
|
func (c *ProjectIssueCommentClient) QueryParent(_m *ProjectIssueComment) *ProjectIssueCommentQuery {
|
|
query := (&ProjectIssueCommentClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(projectissuecomment.Table, projectissuecomment.FieldID, id),
|
|
sqlgraph.To(projectissuecomment.Table, projectissuecomment.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, projectissuecomment.ParentTable, projectissuecomment.ParentColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryReplies queries the replies edge of a ProjectIssueComment.
|
|
func (c *ProjectIssueCommentClient) QueryReplies(_m *ProjectIssueComment) *ProjectIssueCommentQuery {
|
|
query := (&ProjectIssueCommentClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(projectissuecomment.Table, projectissuecomment.FieldID, id),
|
|
sqlgraph.To(projectissuecomment.Table, projectissuecomment.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, projectissuecomment.RepliesTable, projectissuecomment.RepliesColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *ProjectIssueCommentClient) Hooks() []Hook {
|
|
hooks := c.hooks.ProjectIssueComment
|
|
return append(hooks[:len(hooks):len(hooks)], projectissuecomment.Hooks[:]...)
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *ProjectIssueCommentClient) Interceptors() []Interceptor {
|
|
inters := c.inters.ProjectIssueComment
|
|
return append(inters[:len(inters):len(inters)], projectissuecomment.Interceptors[:]...)
|
|
}
|
|
|
|
func (c *ProjectIssueCommentClient) mutate(ctx context.Context, m *ProjectIssueCommentMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&ProjectIssueCommentCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&ProjectIssueCommentUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&ProjectIssueCommentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&ProjectIssueCommentDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown ProjectIssueComment mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// ProjectTaskClient is a client for the ProjectTask schema.
|
|
type ProjectTaskClient struct {
|
|
config
|
|
}
|
|
|
|
// NewProjectTaskClient returns a client for the ProjectTask from the given config.
|
|
func NewProjectTaskClient(c config) *ProjectTaskClient {
|
|
return &ProjectTaskClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `projecttask.Hooks(f(g(h())))`.
|
|
func (c *ProjectTaskClient) Use(hooks ...Hook) {
|
|
c.hooks.ProjectTask = append(c.hooks.ProjectTask, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `projecttask.Intercept(f(g(h())))`.
|
|
func (c *ProjectTaskClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.ProjectTask = append(c.inters.ProjectTask, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a ProjectTask entity.
|
|
func (c *ProjectTaskClient) Create() *ProjectTaskCreate {
|
|
mutation := newProjectTaskMutation(c.config, OpCreate)
|
|
return &ProjectTaskCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of ProjectTask entities.
|
|
func (c *ProjectTaskClient) CreateBulk(builders ...*ProjectTaskCreate) *ProjectTaskCreateBulk {
|
|
return &ProjectTaskCreateBulk{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 *ProjectTaskClient) MapCreateBulk(slice any, setFunc func(*ProjectTaskCreate, int)) *ProjectTaskCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &ProjectTaskCreateBulk{err: fmt.Errorf("calling to ProjectTaskClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*ProjectTaskCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &ProjectTaskCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for ProjectTask.
|
|
func (c *ProjectTaskClient) Update() *ProjectTaskUpdate {
|
|
mutation := newProjectTaskMutation(c.config, OpUpdate)
|
|
return &ProjectTaskUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *ProjectTaskClient) UpdateOne(_m *ProjectTask) *ProjectTaskUpdateOne {
|
|
mutation := newProjectTaskMutation(c.config, OpUpdateOne, withProjectTask(_m))
|
|
return &ProjectTaskUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *ProjectTaskClient) UpdateOneID(id uuid.UUID) *ProjectTaskUpdateOne {
|
|
mutation := newProjectTaskMutation(c.config, OpUpdateOne, withProjectTaskID(id))
|
|
return &ProjectTaskUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for ProjectTask.
|
|
func (c *ProjectTaskClient) Delete() *ProjectTaskDelete {
|
|
mutation := newProjectTaskMutation(c.config, OpDelete)
|
|
return &ProjectTaskDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *ProjectTaskClient) DeleteOne(_m *ProjectTask) *ProjectTaskDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *ProjectTaskClient) DeleteOneID(id uuid.UUID) *ProjectTaskDeleteOne {
|
|
builder := c.Delete().Where(projecttask.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &ProjectTaskDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for ProjectTask.
|
|
func (c *ProjectTaskClient) Query() *ProjectTaskQuery {
|
|
return &ProjectTaskQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeProjectTask},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a ProjectTask entity by its id.
|
|
func (c *ProjectTaskClient) Get(ctx context.Context, id uuid.UUID) (*ProjectTask, error) {
|
|
return c.Query().Where(projecttask.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *ProjectTaskClient) GetX(ctx context.Context, id uuid.UUID) *ProjectTask {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// QueryTask queries the task edge of a ProjectTask.
|
|
func (c *ProjectTaskClient) QueryTask(_m *ProjectTask) *TaskQuery {
|
|
query := (&TaskClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(projecttask.Table, projecttask.FieldID, id),
|
|
sqlgraph.To(task.Table, task.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, projecttask.TaskTable, projecttask.TaskColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryModel queries the model edge of a ProjectTask.
|
|
func (c *ProjectTaskClient) QueryModel(_m *ProjectTask) *ModelQuery {
|
|
query := (&ModelClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(projecttask.Table, projecttask.FieldID, id),
|
|
sqlgraph.To(model.Table, model.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, projecttask.ModelTable, projecttask.ModelColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryImage queries the image edge of a ProjectTask.
|
|
func (c *ProjectTaskClient) QueryImage(_m *ProjectTask) *ImageQuery {
|
|
query := (&ImageClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(projecttask.Table, projecttask.FieldID, id),
|
|
sqlgraph.To(image.Table, image.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, projecttask.ImageTable, projecttask.ImageColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryGitIdentity queries the git_identity edge of a ProjectTask.
|
|
func (c *ProjectTaskClient) QueryGitIdentity(_m *ProjectTask) *GitIdentityQuery {
|
|
query := (&GitIdentityClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(projecttask.Table, projecttask.FieldID, id),
|
|
sqlgraph.To(gitidentity.Table, gitidentity.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, projecttask.GitIdentityTable, projecttask.GitIdentityColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryProject queries the project edge of a ProjectTask.
|
|
func (c *ProjectTaskClient) QueryProject(_m *ProjectTask) *ProjectQuery {
|
|
query := (&ProjectClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(projecttask.Table, projecttask.FieldID, id),
|
|
sqlgraph.To(project.Table, project.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, projecttask.ProjectTable, projecttask.ProjectColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryIssue queries the issue edge of a ProjectTask.
|
|
func (c *ProjectTaskClient) QueryIssue(_m *ProjectTask) *ProjectIssueQuery {
|
|
query := (&ProjectIssueClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(projecttask.Table, projecttask.FieldID, id),
|
|
sqlgraph.To(projectissue.Table, projectissue.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, projecttask.IssueTable, projecttask.IssueColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *ProjectTaskClient) Hooks() []Hook {
|
|
return c.hooks.ProjectTask
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *ProjectTaskClient) Interceptors() []Interceptor {
|
|
return c.inters.ProjectTask
|
|
}
|
|
|
|
func (c *ProjectTaskClient) mutate(ctx context.Context, m *ProjectTaskMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&ProjectTaskCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&ProjectTaskUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&ProjectTaskUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&ProjectTaskDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown ProjectTask mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// TaskClient is a client for the Task schema.
|
|
type TaskClient struct {
|
|
config
|
|
}
|
|
|
|
// NewTaskClient returns a client for the Task from the given config.
|
|
func NewTaskClient(c config) *TaskClient {
|
|
return &TaskClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `task.Hooks(f(g(h())))`.
|
|
func (c *TaskClient) Use(hooks ...Hook) {
|
|
c.hooks.Task = append(c.hooks.Task, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `task.Intercept(f(g(h())))`.
|
|
func (c *TaskClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.Task = append(c.inters.Task, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a Task entity.
|
|
func (c *TaskClient) Create() *TaskCreate {
|
|
mutation := newTaskMutation(c.config, OpCreate)
|
|
return &TaskCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of Task entities.
|
|
func (c *TaskClient) CreateBulk(builders ...*TaskCreate) *TaskCreateBulk {
|
|
return &TaskCreateBulk{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 *TaskClient) MapCreateBulk(slice any, setFunc func(*TaskCreate, int)) *TaskCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &TaskCreateBulk{err: fmt.Errorf("calling to TaskClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*TaskCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &TaskCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for Task.
|
|
func (c *TaskClient) Update() *TaskUpdate {
|
|
mutation := newTaskMutation(c.config, OpUpdate)
|
|
return &TaskUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *TaskClient) UpdateOne(_m *Task) *TaskUpdateOne {
|
|
mutation := newTaskMutation(c.config, OpUpdateOne, withTask(_m))
|
|
return &TaskUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *TaskClient) UpdateOneID(id uuid.UUID) *TaskUpdateOne {
|
|
mutation := newTaskMutation(c.config, OpUpdateOne, withTaskID(id))
|
|
return &TaskUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for Task.
|
|
func (c *TaskClient) Delete() *TaskDelete {
|
|
mutation := newTaskMutation(c.config, OpDelete)
|
|
return &TaskDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *TaskClient) DeleteOne(_m *Task) *TaskDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *TaskClient) DeleteOneID(id uuid.UUID) *TaskDeleteOne {
|
|
builder := c.Delete().Where(task.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &TaskDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for Task.
|
|
func (c *TaskClient) Query() *TaskQuery {
|
|
return &TaskQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeTask},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a Task entity by its id.
|
|
func (c *TaskClient) Get(ctx context.Context, id uuid.UUID) (*Task, error) {
|
|
return c.Query().Where(task.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *TaskClient) GetX(ctx context.Context, id uuid.UUID) *Task {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// QueryProjectTasks queries the project_tasks edge of a Task.
|
|
func (c *TaskClient) QueryProjectTasks(_m *Task) *ProjectTaskQuery {
|
|
query := (&ProjectTaskClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(task.Table, task.FieldID, id),
|
|
sqlgraph.To(projecttask.Table, projecttask.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, task.ProjectTasksTable, task.ProjectTasksColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryUser queries the user edge of a Task.
|
|
func (c *TaskClient) QueryUser(_m *Task) *UserQuery {
|
|
query := (&UserClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(task.Table, task.FieldID, id),
|
|
sqlgraph.To(user.Table, user.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, task.UserTable, task.UserColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryVms queries the vms edge of a Task.
|
|
func (c *TaskClient) QueryVms(_m *Task) *VirtualMachineQuery {
|
|
query := (&VirtualMachineClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(task.Table, task.FieldID, id),
|
|
sqlgraph.To(virtualmachine.Table, virtualmachine.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2M, true, task.VmsTable, task.VmsPrimaryKey...),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryGitBotTasks queries the git_bot_tasks edge of a Task.
|
|
func (c *TaskClient) QueryGitBotTasks(_m *Task) *GitBotTaskQuery {
|
|
query := (&GitBotTaskClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(task.Table, task.FieldID, id),
|
|
sqlgraph.To(gitbottask.Table, gitbottask.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, task.GitBotTasksTable, task.GitBotTasksColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryTaskVms queries the task_vms edge of a Task.
|
|
func (c *TaskClient) QueryTaskVms(_m *Task) *TaskVirtualMachineQuery {
|
|
query := (&TaskVirtualMachineClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(task.Table, task.FieldID, id),
|
|
sqlgraph.To(taskvirtualmachine.Table, taskvirtualmachine.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, true, task.TaskVmsTable, task.TaskVmsColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *TaskClient) Hooks() []Hook {
|
|
hooks := c.hooks.Task
|
|
return append(hooks[:len(hooks):len(hooks)], task.Hooks[:]...)
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *TaskClient) Interceptors() []Interceptor {
|
|
inters := c.inters.Task
|
|
return append(inters[:len(inters):len(inters)], task.Interceptors[:]...)
|
|
}
|
|
|
|
func (c *TaskClient) mutate(ctx context.Context, m *TaskMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&TaskCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&TaskUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&TaskUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&TaskDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown Task mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// TaskVirtualMachineClient is a client for the TaskVirtualMachine schema.
|
|
type TaskVirtualMachineClient struct {
|
|
config
|
|
}
|
|
|
|
// NewTaskVirtualMachineClient returns a client for the TaskVirtualMachine from the given config.
|
|
func NewTaskVirtualMachineClient(c config) *TaskVirtualMachineClient {
|
|
return &TaskVirtualMachineClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `taskvirtualmachine.Hooks(f(g(h())))`.
|
|
func (c *TaskVirtualMachineClient) Use(hooks ...Hook) {
|
|
c.hooks.TaskVirtualMachine = append(c.hooks.TaskVirtualMachine, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `taskvirtualmachine.Intercept(f(g(h())))`.
|
|
func (c *TaskVirtualMachineClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.TaskVirtualMachine = append(c.inters.TaskVirtualMachine, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a TaskVirtualMachine entity.
|
|
func (c *TaskVirtualMachineClient) Create() *TaskVirtualMachineCreate {
|
|
mutation := newTaskVirtualMachineMutation(c.config, OpCreate)
|
|
return &TaskVirtualMachineCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of TaskVirtualMachine entities.
|
|
func (c *TaskVirtualMachineClient) CreateBulk(builders ...*TaskVirtualMachineCreate) *TaskVirtualMachineCreateBulk {
|
|
return &TaskVirtualMachineCreateBulk{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 *TaskVirtualMachineClient) MapCreateBulk(slice any, setFunc func(*TaskVirtualMachineCreate, int)) *TaskVirtualMachineCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &TaskVirtualMachineCreateBulk{err: fmt.Errorf("calling to TaskVirtualMachineClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*TaskVirtualMachineCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &TaskVirtualMachineCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for TaskVirtualMachine.
|
|
func (c *TaskVirtualMachineClient) Update() *TaskVirtualMachineUpdate {
|
|
mutation := newTaskVirtualMachineMutation(c.config, OpUpdate)
|
|
return &TaskVirtualMachineUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *TaskVirtualMachineClient) UpdateOne(_m *TaskVirtualMachine) *TaskVirtualMachineUpdateOne {
|
|
mutation := newTaskVirtualMachineMutation(c.config, OpUpdateOne, withTaskVirtualMachine(_m))
|
|
return &TaskVirtualMachineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *TaskVirtualMachineClient) UpdateOneID(id uuid.UUID) *TaskVirtualMachineUpdateOne {
|
|
mutation := newTaskVirtualMachineMutation(c.config, OpUpdateOne, withTaskVirtualMachineID(id))
|
|
return &TaskVirtualMachineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for TaskVirtualMachine.
|
|
func (c *TaskVirtualMachineClient) Delete() *TaskVirtualMachineDelete {
|
|
mutation := newTaskVirtualMachineMutation(c.config, OpDelete)
|
|
return &TaskVirtualMachineDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *TaskVirtualMachineClient) DeleteOne(_m *TaskVirtualMachine) *TaskVirtualMachineDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *TaskVirtualMachineClient) DeleteOneID(id uuid.UUID) *TaskVirtualMachineDeleteOne {
|
|
builder := c.Delete().Where(taskvirtualmachine.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &TaskVirtualMachineDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for TaskVirtualMachine.
|
|
func (c *TaskVirtualMachineClient) Query() *TaskVirtualMachineQuery {
|
|
return &TaskVirtualMachineQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeTaskVirtualMachine},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a TaskVirtualMachine entity by its id.
|
|
func (c *TaskVirtualMachineClient) Get(ctx context.Context, id uuid.UUID) (*TaskVirtualMachine, error) {
|
|
return c.Query().Where(taskvirtualmachine.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *TaskVirtualMachineClient) GetX(ctx context.Context, id uuid.UUID) *TaskVirtualMachine {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// QueryTask queries the task edge of a TaskVirtualMachine.
|
|
func (c *TaskVirtualMachineClient) QueryTask(_m *TaskVirtualMachine) *TaskQuery {
|
|
query := (&TaskClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(taskvirtualmachine.Table, taskvirtualmachine.FieldID, id),
|
|
sqlgraph.To(task.Table, task.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, false, taskvirtualmachine.TaskTable, taskvirtualmachine.TaskColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryVirtualmachine queries the virtualmachine edge of a TaskVirtualMachine.
|
|
func (c *TaskVirtualMachineClient) QueryVirtualmachine(_m *TaskVirtualMachine) *VirtualMachineQuery {
|
|
query := (&VirtualMachineClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(taskvirtualmachine.Table, taskvirtualmachine.FieldID, id),
|
|
sqlgraph.To(virtualmachine.Table, virtualmachine.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, false, taskvirtualmachine.VirtualmachineTable, taskvirtualmachine.VirtualmachineColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *TaskVirtualMachineClient) Hooks() []Hook {
|
|
return c.hooks.TaskVirtualMachine
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *TaskVirtualMachineClient) Interceptors() []Interceptor {
|
|
return c.inters.TaskVirtualMachine
|
|
}
|
|
|
|
func (c *TaskVirtualMachineClient) mutate(ctx context.Context, m *TaskVirtualMachineMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&TaskVirtualMachineCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&TaskVirtualMachineUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&TaskVirtualMachineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&TaskVirtualMachineDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown TaskVirtualMachine mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// TeamClient is a client for the Team schema.
|
|
type TeamClient struct {
|
|
config
|
|
}
|
|
|
|
// NewTeamClient returns a client for the Team from the given config.
|
|
func NewTeamClient(c config) *TeamClient {
|
|
return &TeamClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `team.Hooks(f(g(h())))`.
|
|
func (c *TeamClient) Use(hooks ...Hook) {
|
|
c.hooks.Team = append(c.hooks.Team, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `team.Intercept(f(g(h())))`.
|
|
func (c *TeamClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.Team = append(c.inters.Team, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a Team entity.
|
|
func (c *TeamClient) Create() *TeamCreate {
|
|
mutation := newTeamMutation(c.config, OpCreate)
|
|
return &TeamCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of Team entities.
|
|
func (c *TeamClient) CreateBulk(builders ...*TeamCreate) *TeamCreateBulk {
|
|
return &TeamCreateBulk{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 *TeamClient) MapCreateBulk(slice any, setFunc func(*TeamCreate, int)) *TeamCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &TeamCreateBulk{err: fmt.Errorf("calling to TeamClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*TeamCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &TeamCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for Team.
|
|
func (c *TeamClient) Update() *TeamUpdate {
|
|
mutation := newTeamMutation(c.config, OpUpdate)
|
|
return &TeamUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *TeamClient) UpdateOne(_m *Team) *TeamUpdateOne {
|
|
mutation := newTeamMutation(c.config, OpUpdateOne, withTeam(_m))
|
|
return &TeamUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *TeamClient) UpdateOneID(id uuid.UUID) *TeamUpdateOne {
|
|
mutation := newTeamMutation(c.config, OpUpdateOne, withTeamID(id))
|
|
return &TeamUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for Team.
|
|
func (c *TeamClient) Delete() *TeamDelete {
|
|
mutation := newTeamMutation(c.config, OpDelete)
|
|
return &TeamDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *TeamClient) DeleteOne(_m *Team) *TeamDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *TeamClient) DeleteOneID(id uuid.UUID) *TeamDeleteOne {
|
|
builder := c.Delete().Where(team.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &TeamDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for Team.
|
|
func (c *TeamClient) Query() *TeamQuery {
|
|
return &TeamQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeTeam},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a Team entity by its id.
|
|
func (c *TeamClient) Get(ctx context.Context, id uuid.UUID) (*Team, error) {
|
|
return c.Query().Where(team.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *TeamClient) GetX(ctx context.Context, id uuid.UUID) *Team {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// QueryGroups queries the groups edge of a Team.
|
|
func (c *TeamClient) QueryGroups(_m *Team) *TeamGroupQuery {
|
|
query := (&TeamGroupClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(team.Table, team.FieldID, id),
|
|
sqlgraph.To(teamgroup.Table, teamgroup.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, team.GroupsTable, team.GroupsColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryMembers queries the members edge of a Team.
|
|
func (c *TeamClient) QueryMembers(_m *Team) *UserQuery {
|
|
query := (&UserClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(team.Table, team.FieldID, id),
|
|
sqlgraph.To(user.Table, user.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2M, true, team.MembersTable, team.MembersPrimaryKey...),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryModels queries the models edge of a Team.
|
|
func (c *TeamClient) QueryModels(_m *Team) *ModelQuery {
|
|
query := (&ModelClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(team.Table, team.FieldID, id),
|
|
sqlgraph.To(model.Table, model.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2M, false, team.ModelsTable, team.ModelsPrimaryKey...),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryImages queries the images edge of a Team.
|
|
func (c *TeamClient) QueryImages(_m *Team) *ImageQuery {
|
|
query := (&ImageClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(team.Table, team.FieldID, id),
|
|
sqlgraph.To(image.Table, image.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2M, false, team.ImagesTable, team.ImagesPrimaryKey...),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryTeamMembers queries the team_members edge of a Team.
|
|
func (c *TeamClient) QueryTeamMembers(_m *Team) *TeamMemberQuery {
|
|
query := (&TeamMemberClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(team.Table, team.FieldID, id),
|
|
sqlgraph.To(teammember.Table, teammember.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, true, team.TeamMembersTable, team.TeamMembersColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryTeamModels queries the team_models edge of a Team.
|
|
func (c *TeamClient) QueryTeamModels(_m *Team) *TeamModelQuery {
|
|
query := (&TeamModelClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(team.Table, team.FieldID, id),
|
|
sqlgraph.To(teammodel.Table, teammodel.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, true, team.TeamModelsTable, team.TeamModelsColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryTeamImages queries the team_images edge of a Team.
|
|
func (c *TeamClient) QueryTeamImages(_m *Team) *TeamImageQuery {
|
|
query := (&TeamImageClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(team.Table, team.FieldID, id),
|
|
sqlgraph.To(teamimage.Table, teamimage.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, true, team.TeamImagesTable, team.TeamImagesColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *TeamClient) Hooks() []Hook {
|
|
hooks := c.hooks.Team
|
|
return append(hooks[:len(hooks):len(hooks)], team.Hooks[:]...)
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *TeamClient) Interceptors() []Interceptor {
|
|
inters := c.inters.Team
|
|
return append(inters[:len(inters):len(inters)], team.Interceptors[:]...)
|
|
}
|
|
|
|
func (c *TeamClient) mutate(ctx context.Context, m *TeamMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&TeamCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&TeamUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&TeamUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&TeamDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown Team mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// TeamGroupClient is a client for the TeamGroup schema.
|
|
type TeamGroupClient struct {
|
|
config
|
|
}
|
|
|
|
// NewTeamGroupClient returns a client for the TeamGroup from the given config.
|
|
func NewTeamGroupClient(c config) *TeamGroupClient {
|
|
return &TeamGroupClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `teamgroup.Hooks(f(g(h())))`.
|
|
func (c *TeamGroupClient) Use(hooks ...Hook) {
|
|
c.hooks.TeamGroup = append(c.hooks.TeamGroup, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `teamgroup.Intercept(f(g(h())))`.
|
|
func (c *TeamGroupClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.TeamGroup = append(c.inters.TeamGroup, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a TeamGroup entity.
|
|
func (c *TeamGroupClient) Create() *TeamGroupCreate {
|
|
mutation := newTeamGroupMutation(c.config, OpCreate)
|
|
return &TeamGroupCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of TeamGroup entities.
|
|
func (c *TeamGroupClient) CreateBulk(builders ...*TeamGroupCreate) *TeamGroupCreateBulk {
|
|
return &TeamGroupCreateBulk{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 *TeamGroupClient) MapCreateBulk(slice any, setFunc func(*TeamGroupCreate, int)) *TeamGroupCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &TeamGroupCreateBulk{err: fmt.Errorf("calling to TeamGroupClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*TeamGroupCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &TeamGroupCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for TeamGroup.
|
|
func (c *TeamGroupClient) Update() *TeamGroupUpdate {
|
|
mutation := newTeamGroupMutation(c.config, OpUpdate)
|
|
return &TeamGroupUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *TeamGroupClient) UpdateOne(_m *TeamGroup) *TeamGroupUpdateOne {
|
|
mutation := newTeamGroupMutation(c.config, OpUpdateOne, withTeamGroup(_m))
|
|
return &TeamGroupUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *TeamGroupClient) UpdateOneID(id uuid.UUID) *TeamGroupUpdateOne {
|
|
mutation := newTeamGroupMutation(c.config, OpUpdateOne, withTeamGroupID(id))
|
|
return &TeamGroupUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for TeamGroup.
|
|
func (c *TeamGroupClient) Delete() *TeamGroupDelete {
|
|
mutation := newTeamGroupMutation(c.config, OpDelete)
|
|
return &TeamGroupDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *TeamGroupClient) DeleteOne(_m *TeamGroup) *TeamGroupDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *TeamGroupClient) DeleteOneID(id uuid.UUID) *TeamGroupDeleteOne {
|
|
builder := c.Delete().Where(teamgroup.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &TeamGroupDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for TeamGroup.
|
|
func (c *TeamGroupClient) Query() *TeamGroupQuery {
|
|
return &TeamGroupQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeTeamGroup},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a TeamGroup entity by its id.
|
|
func (c *TeamGroupClient) Get(ctx context.Context, id uuid.UUID) (*TeamGroup, error) {
|
|
return c.Query().Where(teamgroup.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *TeamGroupClient) GetX(ctx context.Context, id uuid.UUID) *TeamGroup {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// QueryMembers queries the members edge of a TeamGroup.
|
|
func (c *TeamGroupClient) QueryMembers(_m *TeamGroup) *UserQuery {
|
|
query := (&UserClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(teamgroup.Table, teamgroup.FieldID, id),
|
|
sqlgraph.To(user.Table, user.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2M, true, teamgroup.MembersTable, teamgroup.MembersPrimaryKey...),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryTeam queries the team edge of a TeamGroup.
|
|
func (c *TeamGroupClient) QueryTeam(_m *TeamGroup) *TeamQuery {
|
|
query := (&TeamClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(teamgroup.Table, teamgroup.FieldID, id),
|
|
sqlgraph.To(team.Table, team.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, teamgroup.TeamTable, teamgroup.TeamColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryModels queries the models edge of a TeamGroup.
|
|
func (c *TeamGroupClient) QueryModels(_m *TeamGroup) *ModelQuery {
|
|
query := (&ModelClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(teamgroup.Table, teamgroup.FieldID, id),
|
|
sqlgraph.To(model.Table, model.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2M, false, teamgroup.ModelsTable, teamgroup.ModelsPrimaryKey...),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryImages queries the images edge of a TeamGroup.
|
|
func (c *TeamGroupClient) QueryImages(_m *TeamGroup) *ImageQuery {
|
|
query := (&ImageClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(teamgroup.Table, teamgroup.FieldID, id),
|
|
sqlgraph.To(image.Table, image.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2M, false, teamgroup.ImagesTable, teamgroup.ImagesPrimaryKey...),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryHosts queries the hosts edge of a TeamGroup.
|
|
func (c *TeamGroupClient) QueryHosts(_m *TeamGroup) *HostQuery {
|
|
query := (&HostClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(teamgroup.Table, teamgroup.FieldID, id),
|
|
sqlgraph.To(host.Table, host.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2M, false, teamgroup.HostsTable, teamgroup.HostsPrimaryKey...),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryTeamGroupMembers queries the team_group_members edge of a TeamGroup.
|
|
func (c *TeamGroupClient) QueryTeamGroupMembers(_m *TeamGroup) *TeamGroupMemberQuery {
|
|
query := (&TeamGroupMemberClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(teamgroup.Table, teamgroup.FieldID, id),
|
|
sqlgraph.To(teamgroupmember.Table, teamgroupmember.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, true, teamgroup.TeamGroupMembersTable, teamgroup.TeamGroupMembersColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryTeamGroupModels queries the team_group_models edge of a TeamGroup.
|
|
func (c *TeamGroupClient) QueryTeamGroupModels(_m *TeamGroup) *TeamGroupModelQuery {
|
|
query := (&TeamGroupModelClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(teamgroup.Table, teamgroup.FieldID, id),
|
|
sqlgraph.To(teamgroupmodel.Table, teamgroupmodel.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, true, teamgroup.TeamGroupModelsTable, teamgroup.TeamGroupModelsColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryTeamGroupImages queries the team_group_images edge of a TeamGroup.
|
|
func (c *TeamGroupClient) QueryTeamGroupImages(_m *TeamGroup) *TeamGroupImageQuery {
|
|
query := (&TeamGroupImageClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(teamgroup.Table, teamgroup.FieldID, id),
|
|
sqlgraph.To(teamgroupimage.Table, teamgroupimage.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, true, teamgroup.TeamGroupImagesTable, teamgroup.TeamGroupImagesColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryTeamGroupHosts queries the team_group_hosts edge of a TeamGroup.
|
|
func (c *TeamGroupClient) QueryTeamGroupHosts(_m *TeamGroup) *TeamGroupHostQuery {
|
|
query := (&TeamGroupHostClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(teamgroup.Table, teamgroup.FieldID, id),
|
|
sqlgraph.To(teamgrouphost.Table, teamgrouphost.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, true, teamgroup.TeamGroupHostsTable, teamgroup.TeamGroupHostsColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *TeamGroupClient) Hooks() []Hook {
|
|
hooks := c.hooks.TeamGroup
|
|
return append(hooks[:len(hooks):len(hooks)], teamgroup.Hooks[:]...)
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *TeamGroupClient) Interceptors() []Interceptor {
|
|
inters := c.inters.TeamGroup
|
|
return append(inters[:len(inters):len(inters)], teamgroup.Interceptors[:]...)
|
|
}
|
|
|
|
func (c *TeamGroupClient) mutate(ctx context.Context, m *TeamGroupMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&TeamGroupCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&TeamGroupUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&TeamGroupUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&TeamGroupDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown TeamGroup mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// TeamGroupHostClient is a client for the TeamGroupHost schema.
|
|
type TeamGroupHostClient struct {
|
|
config
|
|
}
|
|
|
|
// NewTeamGroupHostClient returns a client for the TeamGroupHost from the given config.
|
|
func NewTeamGroupHostClient(c config) *TeamGroupHostClient {
|
|
return &TeamGroupHostClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `teamgrouphost.Hooks(f(g(h())))`.
|
|
func (c *TeamGroupHostClient) Use(hooks ...Hook) {
|
|
c.hooks.TeamGroupHost = append(c.hooks.TeamGroupHost, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `teamgrouphost.Intercept(f(g(h())))`.
|
|
func (c *TeamGroupHostClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.TeamGroupHost = append(c.inters.TeamGroupHost, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a TeamGroupHost entity.
|
|
func (c *TeamGroupHostClient) Create() *TeamGroupHostCreate {
|
|
mutation := newTeamGroupHostMutation(c.config, OpCreate)
|
|
return &TeamGroupHostCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of TeamGroupHost entities.
|
|
func (c *TeamGroupHostClient) CreateBulk(builders ...*TeamGroupHostCreate) *TeamGroupHostCreateBulk {
|
|
return &TeamGroupHostCreateBulk{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 *TeamGroupHostClient) MapCreateBulk(slice any, setFunc func(*TeamGroupHostCreate, int)) *TeamGroupHostCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &TeamGroupHostCreateBulk{err: fmt.Errorf("calling to TeamGroupHostClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*TeamGroupHostCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &TeamGroupHostCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for TeamGroupHost.
|
|
func (c *TeamGroupHostClient) Update() *TeamGroupHostUpdate {
|
|
mutation := newTeamGroupHostMutation(c.config, OpUpdate)
|
|
return &TeamGroupHostUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *TeamGroupHostClient) UpdateOne(_m *TeamGroupHost) *TeamGroupHostUpdateOne {
|
|
mutation := newTeamGroupHostMutation(c.config, OpUpdateOne, withTeamGroupHost(_m))
|
|
return &TeamGroupHostUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *TeamGroupHostClient) UpdateOneID(id uuid.UUID) *TeamGroupHostUpdateOne {
|
|
mutation := newTeamGroupHostMutation(c.config, OpUpdateOne, withTeamGroupHostID(id))
|
|
return &TeamGroupHostUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for TeamGroupHost.
|
|
func (c *TeamGroupHostClient) Delete() *TeamGroupHostDelete {
|
|
mutation := newTeamGroupHostMutation(c.config, OpDelete)
|
|
return &TeamGroupHostDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *TeamGroupHostClient) DeleteOne(_m *TeamGroupHost) *TeamGroupHostDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *TeamGroupHostClient) DeleteOneID(id uuid.UUID) *TeamGroupHostDeleteOne {
|
|
builder := c.Delete().Where(teamgrouphost.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &TeamGroupHostDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for TeamGroupHost.
|
|
func (c *TeamGroupHostClient) Query() *TeamGroupHostQuery {
|
|
return &TeamGroupHostQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeTeamGroupHost},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a TeamGroupHost entity by its id.
|
|
func (c *TeamGroupHostClient) Get(ctx context.Context, id uuid.UUID) (*TeamGroupHost, error) {
|
|
return c.Query().Where(teamgrouphost.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *TeamGroupHostClient) GetX(ctx context.Context, id uuid.UUID) *TeamGroupHost {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// QueryGroup queries the group edge of a TeamGroupHost.
|
|
func (c *TeamGroupHostClient) QueryGroup(_m *TeamGroupHost) *TeamGroupQuery {
|
|
query := (&TeamGroupClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(teamgrouphost.Table, teamgrouphost.FieldID, id),
|
|
sqlgraph.To(teamgroup.Table, teamgroup.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, false, teamgrouphost.GroupTable, teamgrouphost.GroupColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryHost queries the host edge of a TeamGroupHost.
|
|
func (c *TeamGroupHostClient) QueryHost(_m *TeamGroupHost) *HostQuery {
|
|
query := (&HostClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(teamgrouphost.Table, teamgrouphost.FieldID, id),
|
|
sqlgraph.To(host.Table, host.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, false, teamgrouphost.HostTable, teamgrouphost.HostColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *TeamGroupHostClient) Hooks() []Hook {
|
|
return c.hooks.TeamGroupHost
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *TeamGroupHostClient) Interceptors() []Interceptor {
|
|
return c.inters.TeamGroupHost
|
|
}
|
|
|
|
func (c *TeamGroupHostClient) mutate(ctx context.Context, m *TeamGroupHostMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&TeamGroupHostCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&TeamGroupHostUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&TeamGroupHostUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&TeamGroupHostDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown TeamGroupHost mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// TeamGroupImageClient is a client for the TeamGroupImage schema.
|
|
type TeamGroupImageClient struct {
|
|
config
|
|
}
|
|
|
|
// NewTeamGroupImageClient returns a client for the TeamGroupImage from the given config.
|
|
func NewTeamGroupImageClient(c config) *TeamGroupImageClient {
|
|
return &TeamGroupImageClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `teamgroupimage.Hooks(f(g(h())))`.
|
|
func (c *TeamGroupImageClient) Use(hooks ...Hook) {
|
|
c.hooks.TeamGroupImage = append(c.hooks.TeamGroupImage, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `teamgroupimage.Intercept(f(g(h())))`.
|
|
func (c *TeamGroupImageClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.TeamGroupImage = append(c.inters.TeamGroupImage, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a TeamGroupImage entity.
|
|
func (c *TeamGroupImageClient) Create() *TeamGroupImageCreate {
|
|
mutation := newTeamGroupImageMutation(c.config, OpCreate)
|
|
return &TeamGroupImageCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of TeamGroupImage entities.
|
|
func (c *TeamGroupImageClient) CreateBulk(builders ...*TeamGroupImageCreate) *TeamGroupImageCreateBulk {
|
|
return &TeamGroupImageCreateBulk{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 *TeamGroupImageClient) MapCreateBulk(slice any, setFunc func(*TeamGroupImageCreate, int)) *TeamGroupImageCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &TeamGroupImageCreateBulk{err: fmt.Errorf("calling to TeamGroupImageClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*TeamGroupImageCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &TeamGroupImageCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for TeamGroupImage.
|
|
func (c *TeamGroupImageClient) Update() *TeamGroupImageUpdate {
|
|
mutation := newTeamGroupImageMutation(c.config, OpUpdate)
|
|
return &TeamGroupImageUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *TeamGroupImageClient) UpdateOne(_m *TeamGroupImage) *TeamGroupImageUpdateOne {
|
|
mutation := newTeamGroupImageMutation(c.config, OpUpdateOne, withTeamGroupImage(_m))
|
|
return &TeamGroupImageUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *TeamGroupImageClient) UpdateOneID(id uuid.UUID) *TeamGroupImageUpdateOne {
|
|
mutation := newTeamGroupImageMutation(c.config, OpUpdateOne, withTeamGroupImageID(id))
|
|
return &TeamGroupImageUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for TeamGroupImage.
|
|
func (c *TeamGroupImageClient) Delete() *TeamGroupImageDelete {
|
|
mutation := newTeamGroupImageMutation(c.config, OpDelete)
|
|
return &TeamGroupImageDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *TeamGroupImageClient) DeleteOne(_m *TeamGroupImage) *TeamGroupImageDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *TeamGroupImageClient) DeleteOneID(id uuid.UUID) *TeamGroupImageDeleteOne {
|
|
builder := c.Delete().Where(teamgroupimage.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &TeamGroupImageDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for TeamGroupImage.
|
|
func (c *TeamGroupImageClient) Query() *TeamGroupImageQuery {
|
|
return &TeamGroupImageQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeTeamGroupImage},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a TeamGroupImage entity by its id.
|
|
func (c *TeamGroupImageClient) Get(ctx context.Context, id uuid.UUID) (*TeamGroupImage, error) {
|
|
return c.Query().Where(teamgroupimage.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *TeamGroupImageClient) GetX(ctx context.Context, id uuid.UUID) *TeamGroupImage {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// QueryGroup queries the group edge of a TeamGroupImage.
|
|
func (c *TeamGroupImageClient) QueryGroup(_m *TeamGroupImage) *TeamGroupQuery {
|
|
query := (&TeamGroupClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(teamgroupimage.Table, teamgroupimage.FieldID, id),
|
|
sqlgraph.To(teamgroup.Table, teamgroup.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, false, teamgroupimage.GroupTable, teamgroupimage.GroupColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryImage queries the image edge of a TeamGroupImage.
|
|
func (c *TeamGroupImageClient) QueryImage(_m *TeamGroupImage) *ImageQuery {
|
|
query := (&ImageClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(teamgroupimage.Table, teamgroupimage.FieldID, id),
|
|
sqlgraph.To(image.Table, image.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, false, teamgroupimage.ImageTable, teamgroupimage.ImageColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *TeamGroupImageClient) Hooks() []Hook {
|
|
return c.hooks.TeamGroupImage
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *TeamGroupImageClient) Interceptors() []Interceptor {
|
|
return c.inters.TeamGroupImage
|
|
}
|
|
|
|
func (c *TeamGroupImageClient) mutate(ctx context.Context, m *TeamGroupImageMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&TeamGroupImageCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&TeamGroupImageUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&TeamGroupImageUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&TeamGroupImageDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown TeamGroupImage mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// TeamGroupMemberClient is a client for the TeamGroupMember schema.
|
|
type TeamGroupMemberClient struct {
|
|
config
|
|
}
|
|
|
|
// NewTeamGroupMemberClient returns a client for the TeamGroupMember from the given config.
|
|
func NewTeamGroupMemberClient(c config) *TeamGroupMemberClient {
|
|
return &TeamGroupMemberClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `teamgroupmember.Hooks(f(g(h())))`.
|
|
func (c *TeamGroupMemberClient) Use(hooks ...Hook) {
|
|
c.hooks.TeamGroupMember = append(c.hooks.TeamGroupMember, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `teamgroupmember.Intercept(f(g(h())))`.
|
|
func (c *TeamGroupMemberClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.TeamGroupMember = append(c.inters.TeamGroupMember, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a TeamGroupMember entity.
|
|
func (c *TeamGroupMemberClient) Create() *TeamGroupMemberCreate {
|
|
mutation := newTeamGroupMemberMutation(c.config, OpCreate)
|
|
return &TeamGroupMemberCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of TeamGroupMember entities.
|
|
func (c *TeamGroupMemberClient) CreateBulk(builders ...*TeamGroupMemberCreate) *TeamGroupMemberCreateBulk {
|
|
return &TeamGroupMemberCreateBulk{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 *TeamGroupMemberClient) MapCreateBulk(slice any, setFunc func(*TeamGroupMemberCreate, int)) *TeamGroupMemberCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &TeamGroupMemberCreateBulk{err: fmt.Errorf("calling to TeamGroupMemberClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*TeamGroupMemberCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &TeamGroupMemberCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for TeamGroupMember.
|
|
func (c *TeamGroupMemberClient) Update() *TeamGroupMemberUpdate {
|
|
mutation := newTeamGroupMemberMutation(c.config, OpUpdate)
|
|
return &TeamGroupMemberUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *TeamGroupMemberClient) UpdateOne(_m *TeamGroupMember) *TeamGroupMemberUpdateOne {
|
|
mutation := newTeamGroupMemberMutation(c.config, OpUpdateOne, withTeamGroupMember(_m))
|
|
return &TeamGroupMemberUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *TeamGroupMemberClient) UpdateOneID(id uuid.UUID) *TeamGroupMemberUpdateOne {
|
|
mutation := newTeamGroupMemberMutation(c.config, OpUpdateOne, withTeamGroupMemberID(id))
|
|
return &TeamGroupMemberUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for TeamGroupMember.
|
|
func (c *TeamGroupMemberClient) Delete() *TeamGroupMemberDelete {
|
|
mutation := newTeamGroupMemberMutation(c.config, OpDelete)
|
|
return &TeamGroupMemberDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *TeamGroupMemberClient) DeleteOne(_m *TeamGroupMember) *TeamGroupMemberDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *TeamGroupMemberClient) DeleteOneID(id uuid.UUID) *TeamGroupMemberDeleteOne {
|
|
builder := c.Delete().Where(teamgroupmember.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &TeamGroupMemberDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for TeamGroupMember.
|
|
func (c *TeamGroupMemberClient) Query() *TeamGroupMemberQuery {
|
|
return &TeamGroupMemberQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeTeamGroupMember},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a TeamGroupMember entity by its id.
|
|
func (c *TeamGroupMemberClient) Get(ctx context.Context, id uuid.UUID) (*TeamGroupMember, error) {
|
|
return c.Query().Where(teamgroupmember.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *TeamGroupMemberClient) GetX(ctx context.Context, id uuid.UUID) *TeamGroupMember {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// QueryGroup queries the group edge of a TeamGroupMember.
|
|
func (c *TeamGroupMemberClient) QueryGroup(_m *TeamGroupMember) *TeamGroupQuery {
|
|
query := (&TeamGroupClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(teamgroupmember.Table, teamgroupmember.FieldID, id),
|
|
sqlgraph.To(teamgroup.Table, teamgroup.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, false, teamgroupmember.GroupTable, teamgroupmember.GroupColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryUser queries the user edge of a TeamGroupMember.
|
|
func (c *TeamGroupMemberClient) QueryUser(_m *TeamGroupMember) *UserQuery {
|
|
query := (&UserClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(teamgroupmember.Table, teamgroupmember.FieldID, id),
|
|
sqlgraph.To(user.Table, user.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, false, teamgroupmember.UserTable, teamgroupmember.UserColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *TeamGroupMemberClient) Hooks() []Hook {
|
|
return c.hooks.TeamGroupMember
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *TeamGroupMemberClient) Interceptors() []Interceptor {
|
|
return c.inters.TeamGroupMember
|
|
}
|
|
|
|
func (c *TeamGroupMemberClient) mutate(ctx context.Context, m *TeamGroupMemberMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&TeamGroupMemberCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&TeamGroupMemberUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&TeamGroupMemberUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&TeamGroupMemberDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown TeamGroupMember mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// TeamGroupModelClient is a client for the TeamGroupModel schema.
|
|
type TeamGroupModelClient struct {
|
|
config
|
|
}
|
|
|
|
// NewTeamGroupModelClient returns a client for the TeamGroupModel from the given config.
|
|
func NewTeamGroupModelClient(c config) *TeamGroupModelClient {
|
|
return &TeamGroupModelClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `teamgroupmodel.Hooks(f(g(h())))`.
|
|
func (c *TeamGroupModelClient) Use(hooks ...Hook) {
|
|
c.hooks.TeamGroupModel = append(c.hooks.TeamGroupModel, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `teamgroupmodel.Intercept(f(g(h())))`.
|
|
func (c *TeamGroupModelClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.TeamGroupModel = append(c.inters.TeamGroupModel, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a TeamGroupModel entity.
|
|
func (c *TeamGroupModelClient) Create() *TeamGroupModelCreate {
|
|
mutation := newTeamGroupModelMutation(c.config, OpCreate)
|
|
return &TeamGroupModelCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of TeamGroupModel entities.
|
|
func (c *TeamGroupModelClient) CreateBulk(builders ...*TeamGroupModelCreate) *TeamGroupModelCreateBulk {
|
|
return &TeamGroupModelCreateBulk{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 *TeamGroupModelClient) MapCreateBulk(slice any, setFunc func(*TeamGroupModelCreate, int)) *TeamGroupModelCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &TeamGroupModelCreateBulk{err: fmt.Errorf("calling to TeamGroupModelClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*TeamGroupModelCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &TeamGroupModelCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for TeamGroupModel.
|
|
func (c *TeamGroupModelClient) Update() *TeamGroupModelUpdate {
|
|
mutation := newTeamGroupModelMutation(c.config, OpUpdate)
|
|
return &TeamGroupModelUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *TeamGroupModelClient) UpdateOne(_m *TeamGroupModel) *TeamGroupModelUpdateOne {
|
|
mutation := newTeamGroupModelMutation(c.config, OpUpdateOne, withTeamGroupModel(_m))
|
|
return &TeamGroupModelUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *TeamGroupModelClient) UpdateOneID(id uuid.UUID) *TeamGroupModelUpdateOne {
|
|
mutation := newTeamGroupModelMutation(c.config, OpUpdateOne, withTeamGroupModelID(id))
|
|
return &TeamGroupModelUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for TeamGroupModel.
|
|
func (c *TeamGroupModelClient) Delete() *TeamGroupModelDelete {
|
|
mutation := newTeamGroupModelMutation(c.config, OpDelete)
|
|
return &TeamGroupModelDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *TeamGroupModelClient) DeleteOne(_m *TeamGroupModel) *TeamGroupModelDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *TeamGroupModelClient) DeleteOneID(id uuid.UUID) *TeamGroupModelDeleteOne {
|
|
builder := c.Delete().Where(teamgroupmodel.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &TeamGroupModelDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for TeamGroupModel.
|
|
func (c *TeamGroupModelClient) Query() *TeamGroupModelQuery {
|
|
return &TeamGroupModelQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeTeamGroupModel},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a TeamGroupModel entity by its id.
|
|
func (c *TeamGroupModelClient) Get(ctx context.Context, id uuid.UUID) (*TeamGroupModel, error) {
|
|
return c.Query().Where(teamgroupmodel.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *TeamGroupModelClient) GetX(ctx context.Context, id uuid.UUID) *TeamGroupModel {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// QueryGroup queries the group edge of a TeamGroupModel.
|
|
func (c *TeamGroupModelClient) QueryGroup(_m *TeamGroupModel) *TeamGroupQuery {
|
|
query := (&TeamGroupClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(teamgroupmodel.Table, teamgroupmodel.FieldID, id),
|
|
sqlgraph.To(teamgroup.Table, teamgroup.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, false, teamgroupmodel.GroupTable, teamgroupmodel.GroupColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryModel queries the model edge of a TeamGroupModel.
|
|
func (c *TeamGroupModelClient) QueryModel(_m *TeamGroupModel) *ModelQuery {
|
|
query := (&ModelClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(teamgroupmodel.Table, teamgroupmodel.FieldID, id),
|
|
sqlgraph.To(model.Table, model.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, false, teamgroupmodel.ModelTable, teamgroupmodel.ModelColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *TeamGroupModelClient) Hooks() []Hook {
|
|
return c.hooks.TeamGroupModel
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *TeamGroupModelClient) Interceptors() []Interceptor {
|
|
return c.inters.TeamGroupModel
|
|
}
|
|
|
|
func (c *TeamGroupModelClient) mutate(ctx context.Context, m *TeamGroupModelMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&TeamGroupModelCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&TeamGroupModelUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&TeamGroupModelUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&TeamGroupModelDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown TeamGroupModel mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// TeamHostClient is a client for the TeamHost schema.
|
|
type TeamHostClient struct {
|
|
config
|
|
}
|
|
|
|
// NewTeamHostClient returns a client for the TeamHost from the given config.
|
|
func NewTeamHostClient(c config) *TeamHostClient {
|
|
return &TeamHostClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `teamhost.Hooks(f(g(h())))`.
|
|
func (c *TeamHostClient) Use(hooks ...Hook) {
|
|
c.hooks.TeamHost = append(c.hooks.TeamHost, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `teamhost.Intercept(f(g(h())))`.
|
|
func (c *TeamHostClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.TeamHost = append(c.inters.TeamHost, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a TeamHost entity.
|
|
func (c *TeamHostClient) Create() *TeamHostCreate {
|
|
mutation := newTeamHostMutation(c.config, OpCreate)
|
|
return &TeamHostCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of TeamHost entities.
|
|
func (c *TeamHostClient) CreateBulk(builders ...*TeamHostCreate) *TeamHostCreateBulk {
|
|
return &TeamHostCreateBulk{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 *TeamHostClient) MapCreateBulk(slice any, setFunc func(*TeamHostCreate, int)) *TeamHostCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &TeamHostCreateBulk{err: fmt.Errorf("calling to TeamHostClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*TeamHostCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &TeamHostCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for TeamHost.
|
|
func (c *TeamHostClient) Update() *TeamHostUpdate {
|
|
mutation := newTeamHostMutation(c.config, OpUpdate)
|
|
return &TeamHostUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *TeamHostClient) UpdateOne(_m *TeamHost) *TeamHostUpdateOne {
|
|
mutation := newTeamHostMutation(c.config, OpUpdateOne, withTeamHost(_m))
|
|
return &TeamHostUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *TeamHostClient) UpdateOneID(id uuid.UUID) *TeamHostUpdateOne {
|
|
mutation := newTeamHostMutation(c.config, OpUpdateOne, withTeamHostID(id))
|
|
return &TeamHostUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for TeamHost.
|
|
func (c *TeamHostClient) Delete() *TeamHostDelete {
|
|
mutation := newTeamHostMutation(c.config, OpDelete)
|
|
return &TeamHostDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *TeamHostClient) DeleteOne(_m *TeamHost) *TeamHostDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *TeamHostClient) DeleteOneID(id uuid.UUID) *TeamHostDeleteOne {
|
|
builder := c.Delete().Where(teamhost.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &TeamHostDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for TeamHost.
|
|
func (c *TeamHostClient) Query() *TeamHostQuery {
|
|
return &TeamHostQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeTeamHost},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a TeamHost entity by its id.
|
|
func (c *TeamHostClient) Get(ctx context.Context, id uuid.UUID) (*TeamHost, error) {
|
|
return c.Query().Where(teamhost.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *TeamHostClient) GetX(ctx context.Context, id uuid.UUID) *TeamHost {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// QueryTeam queries the team edge of a TeamHost.
|
|
func (c *TeamHostClient) QueryTeam(_m *TeamHost) *TeamQuery {
|
|
query := (&TeamClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(teamhost.Table, teamhost.FieldID, id),
|
|
sqlgraph.To(team.Table, team.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, false, teamhost.TeamTable, teamhost.TeamColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryHost queries the host edge of a TeamHost.
|
|
func (c *TeamHostClient) QueryHost(_m *TeamHost) *HostQuery {
|
|
query := (&HostClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(teamhost.Table, teamhost.FieldID, id),
|
|
sqlgraph.To(host.Table, host.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, false, teamhost.HostTable, teamhost.HostColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *TeamHostClient) Hooks() []Hook {
|
|
return c.hooks.TeamHost
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *TeamHostClient) Interceptors() []Interceptor {
|
|
return c.inters.TeamHost
|
|
}
|
|
|
|
func (c *TeamHostClient) mutate(ctx context.Context, m *TeamHostMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&TeamHostCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&TeamHostUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&TeamHostUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&TeamHostDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown TeamHost mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// TeamImageClient is a client for the TeamImage schema.
|
|
type TeamImageClient struct {
|
|
config
|
|
}
|
|
|
|
// NewTeamImageClient returns a client for the TeamImage from the given config.
|
|
func NewTeamImageClient(c config) *TeamImageClient {
|
|
return &TeamImageClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `teamimage.Hooks(f(g(h())))`.
|
|
func (c *TeamImageClient) Use(hooks ...Hook) {
|
|
c.hooks.TeamImage = append(c.hooks.TeamImage, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `teamimage.Intercept(f(g(h())))`.
|
|
func (c *TeamImageClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.TeamImage = append(c.inters.TeamImage, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a TeamImage entity.
|
|
func (c *TeamImageClient) Create() *TeamImageCreate {
|
|
mutation := newTeamImageMutation(c.config, OpCreate)
|
|
return &TeamImageCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of TeamImage entities.
|
|
func (c *TeamImageClient) CreateBulk(builders ...*TeamImageCreate) *TeamImageCreateBulk {
|
|
return &TeamImageCreateBulk{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 *TeamImageClient) MapCreateBulk(slice any, setFunc func(*TeamImageCreate, int)) *TeamImageCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &TeamImageCreateBulk{err: fmt.Errorf("calling to TeamImageClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*TeamImageCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &TeamImageCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for TeamImage.
|
|
func (c *TeamImageClient) Update() *TeamImageUpdate {
|
|
mutation := newTeamImageMutation(c.config, OpUpdate)
|
|
return &TeamImageUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *TeamImageClient) UpdateOne(_m *TeamImage) *TeamImageUpdateOne {
|
|
mutation := newTeamImageMutation(c.config, OpUpdateOne, withTeamImage(_m))
|
|
return &TeamImageUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *TeamImageClient) UpdateOneID(id uuid.UUID) *TeamImageUpdateOne {
|
|
mutation := newTeamImageMutation(c.config, OpUpdateOne, withTeamImageID(id))
|
|
return &TeamImageUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for TeamImage.
|
|
func (c *TeamImageClient) Delete() *TeamImageDelete {
|
|
mutation := newTeamImageMutation(c.config, OpDelete)
|
|
return &TeamImageDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *TeamImageClient) DeleteOne(_m *TeamImage) *TeamImageDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *TeamImageClient) DeleteOneID(id uuid.UUID) *TeamImageDeleteOne {
|
|
builder := c.Delete().Where(teamimage.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &TeamImageDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for TeamImage.
|
|
func (c *TeamImageClient) Query() *TeamImageQuery {
|
|
return &TeamImageQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeTeamImage},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a TeamImage entity by its id.
|
|
func (c *TeamImageClient) Get(ctx context.Context, id uuid.UUID) (*TeamImage, error) {
|
|
return c.Query().Where(teamimage.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *TeamImageClient) GetX(ctx context.Context, id uuid.UUID) *TeamImage {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// QueryTeam queries the team edge of a TeamImage.
|
|
func (c *TeamImageClient) QueryTeam(_m *TeamImage) *TeamQuery {
|
|
query := (&TeamClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(teamimage.Table, teamimage.FieldID, id),
|
|
sqlgraph.To(team.Table, team.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, false, teamimage.TeamTable, teamimage.TeamColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryImage queries the image edge of a TeamImage.
|
|
func (c *TeamImageClient) QueryImage(_m *TeamImage) *ImageQuery {
|
|
query := (&ImageClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(teamimage.Table, teamimage.FieldID, id),
|
|
sqlgraph.To(image.Table, image.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, false, teamimage.ImageTable, teamimage.ImageColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *TeamImageClient) Hooks() []Hook {
|
|
return c.hooks.TeamImage
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *TeamImageClient) Interceptors() []Interceptor {
|
|
return c.inters.TeamImage
|
|
}
|
|
|
|
func (c *TeamImageClient) mutate(ctx context.Context, m *TeamImageMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&TeamImageCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&TeamImageUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&TeamImageUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&TeamImageDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown TeamImage mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// TeamMemberClient is a client for the TeamMember schema.
|
|
type TeamMemberClient struct {
|
|
config
|
|
}
|
|
|
|
// NewTeamMemberClient returns a client for the TeamMember from the given config.
|
|
func NewTeamMemberClient(c config) *TeamMemberClient {
|
|
return &TeamMemberClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `teammember.Hooks(f(g(h())))`.
|
|
func (c *TeamMemberClient) Use(hooks ...Hook) {
|
|
c.hooks.TeamMember = append(c.hooks.TeamMember, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `teammember.Intercept(f(g(h())))`.
|
|
func (c *TeamMemberClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.TeamMember = append(c.inters.TeamMember, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a TeamMember entity.
|
|
func (c *TeamMemberClient) Create() *TeamMemberCreate {
|
|
mutation := newTeamMemberMutation(c.config, OpCreate)
|
|
return &TeamMemberCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of TeamMember entities.
|
|
func (c *TeamMemberClient) CreateBulk(builders ...*TeamMemberCreate) *TeamMemberCreateBulk {
|
|
return &TeamMemberCreateBulk{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 *TeamMemberClient) MapCreateBulk(slice any, setFunc func(*TeamMemberCreate, int)) *TeamMemberCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &TeamMemberCreateBulk{err: fmt.Errorf("calling to TeamMemberClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*TeamMemberCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &TeamMemberCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for TeamMember.
|
|
func (c *TeamMemberClient) Update() *TeamMemberUpdate {
|
|
mutation := newTeamMemberMutation(c.config, OpUpdate)
|
|
return &TeamMemberUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *TeamMemberClient) UpdateOne(_m *TeamMember) *TeamMemberUpdateOne {
|
|
mutation := newTeamMemberMutation(c.config, OpUpdateOne, withTeamMember(_m))
|
|
return &TeamMemberUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *TeamMemberClient) UpdateOneID(id uuid.UUID) *TeamMemberUpdateOne {
|
|
mutation := newTeamMemberMutation(c.config, OpUpdateOne, withTeamMemberID(id))
|
|
return &TeamMemberUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for TeamMember.
|
|
func (c *TeamMemberClient) Delete() *TeamMemberDelete {
|
|
mutation := newTeamMemberMutation(c.config, OpDelete)
|
|
return &TeamMemberDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *TeamMemberClient) DeleteOne(_m *TeamMember) *TeamMemberDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *TeamMemberClient) DeleteOneID(id uuid.UUID) *TeamMemberDeleteOne {
|
|
builder := c.Delete().Where(teammember.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &TeamMemberDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for TeamMember.
|
|
func (c *TeamMemberClient) Query() *TeamMemberQuery {
|
|
return &TeamMemberQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeTeamMember},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a TeamMember entity by its id.
|
|
func (c *TeamMemberClient) Get(ctx context.Context, id uuid.UUID) (*TeamMember, error) {
|
|
return c.Query().Where(teammember.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *TeamMemberClient) GetX(ctx context.Context, id uuid.UUID) *TeamMember {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// QueryTeam queries the team edge of a TeamMember.
|
|
func (c *TeamMemberClient) QueryTeam(_m *TeamMember) *TeamQuery {
|
|
query := (&TeamClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(teammember.Table, teammember.FieldID, id),
|
|
sqlgraph.To(team.Table, team.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, false, teammember.TeamTable, teammember.TeamColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryUser queries the user edge of a TeamMember.
|
|
func (c *TeamMemberClient) QueryUser(_m *TeamMember) *UserQuery {
|
|
query := (&UserClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(teammember.Table, teammember.FieldID, id),
|
|
sqlgraph.To(user.Table, user.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, false, teammember.UserTable, teammember.UserColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *TeamMemberClient) Hooks() []Hook {
|
|
return c.hooks.TeamMember
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *TeamMemberClient) Interceptors() []Interceptor {
|
|
return c.inters.TeamMember
|
|
}
|
|
|
|
func (c *TeamMemberClient) mutate(ctx context.Context, m *TeamMemberMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&TeamMemberCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&TeamMemberUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&TeamMemberUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&TeamMemberDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown TeamMember mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// TeamModelClient is a client for the TeamModel schema.
|
|
type TeamModelClient struct {
|
|
config
|
|
}
|
|
|
|
// NewTeamModelClient returns a client for the TeamModel from the given config.
|
|
func NewTeamModelClient(c config) *TeamModelClient {
|
|
return &TeamModelClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `teammodel.Hooks(f(g(h())))`.
|
|
func (c *TeamModelClient) Use(hooks ...Hook) {
|
|
c.hooks.TeamModel = append(c.hooks.TeamModel, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `teammodel.Intercept(f(g(h())))`.
|
|
func (c *TeamModelClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.TeamModel = append(c.inters.TeamModel, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a TeamModel entity.
|
|
func (c *TeamModelClient) Create() *TeamModelCreate {
|
|
mutation := newTeamModelMutation(c.config, OpCreate)
|
|
return &TeamModelCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of TeamModel entities.
|
|
func (c *TeamModelClient) CreateBulk(builders ...*TeamModelCreate) *TeamModelCreateBulk {
|
|
return &TeamModelCreateBulk{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 *TeamModelClient) MapCreateBulk(slice any, setFunc func(*TeamModelCreate, int)) *TeamModelCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &TeamModelCreateBulk{err: fmt.Errorf("calling to TeamModelClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*TeamModelCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &TeamModelCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for TeamModel.
|
|
func (c *TeamModelClient) Update() *TeamModelUpdate {
|
|
mutation := newTeamModelMutation(c.config, OpUpdate)
|
|
return &TeamModelUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *TeamModelClient) UpdateOne(_m *TeamModel) *TeamModelUpdateOne {
|
|
mutation := newTeamModelMutation(c.config, OpUpdateOne, withTeamModel(_m))
|
|
return &TeamModelUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *TeamModelClient) UpdateOneID(id uuid.UUID) *TeamModelUpdateOne {
|
|
mutation := newTeamModelMutation(c.config, OpUpdateOne, withTeamModelID(id))
|
|
return &TeamModelUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for TeamModel.
|
|
func (c *TeamModelClient) Delete() *TeamModelDelete {
|
|
mutation := newTeamModelMutation(c.config, OpDelete)
|
|
return &TeamModelDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *TeamModelClient) DeleteOne(_m *TeamModel) *TeamModelDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *TeamModelClient) DeleteOneID(id uuid.UUID) *TeamModelDeleteOne {
|
|
builder := c.Delete().Where(teammodel.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &TeamModelDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for TeamModel.
|
|
func (c *TeamModelClient) Query() *TeamModelQuery {
|
|
return &TeamModelQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeTeamModel},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a TeamModel entity by its id.
|
|
func (c *TeamModelClient) Get(ctx context.Context, id uuid.UUID) (*TeamModel, error) {
|
|
return c.Query().Where(teammodel.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *TeamModelClient) GetX(ctx context.Context, id uuid.UUID) *TeamModel {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// QueryTeam queries the team edge of a TeamModel.
|
|
func (c *TeamModelClient) QueryTeam(_m *TeamModel) *TeamQuery {
|
|
query := (&TeamClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(teammodel.Table, teammodel.FieldID, id),
|
|
sqlgraph.To(team.Table, team.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, false, teammodel.TeamTable, teammodel.TeamColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryModel queries the model edge of a TeamModel.
|
|
func (c *TeamModelClient) QueryModel(_m *TeamModel) *ModelQuery {
|
|
query := (&ModelClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(teammodel.Table, teammodel.FieldID, id),
|
|
sqlgraph.To(model.Table, model.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, false, teammodel.ModelTable, teammodel.ModelColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *TeamModelClient) Hooks() []Hook {
|
|
return c.hooks.TeamModel
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *TeamModelClient) Interceptors() []Interceptor {
|
|
return c.inters.TeamModel
|
|
}
|
|
|
|
func (c *TeamModelClient) mutate(ctx context.Context, m *TeamModelMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&TeamModelCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&TeamModelUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&TeamModelUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&TeamModelDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown TeamModel 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 uuid.UUID) *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 uuid.UUID) *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 uuid.UUID) (*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 uuid.UUID) *User {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// QueryIdentities queries the identities edge of a User.
|
|
func (c *UserClient) QueryIdentities(_m *User) *UserIdentityQuery {
|
|
query := (&UserIdentityClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(user.Table, user.FieldID, id),
|
|
sqlgraph.To(useridentity.Table, useridentity.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, user.IdentitiesTable, user.IdentitiesColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryAudits queries the audits edge of a User.
|
|
func (c *UserClient) QueryAudits(_m *User) *AuditQuery {
|
|
query := (&AuditClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(user.Table, user.FieldID, id),
|
|
sqlgraph.To(audit.Table, audit.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, user.AuditsTable, user.AuditsColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryTeams queries the teams edge of a User.
|
|
func (c *UserClient) QueryTeams(_m *User) *TeamQuery {
|
|
query := (&TeamClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(user.Table, user.FieldID, id),
|
|
sqlgraph.To(team.Table, team.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2M, false, user.TeamsTable, user.TeamsPrimaryKey...),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryGroups queries the groups edge of a User.
|
|
func (c *UserClient) QueryGroups(_m *User) *TeamGroupQuery {
|
|
query := (&TeamGroupClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(user.Table, user.FieldID, id),
|
|
sqlgraph.To(teamgroup.Table, teamgroup.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2M, false, user.GroupsTable, user.GroupsPrimaryKey...),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryModels queries the models edge of a User.
|
|
func (c *UserClient) QueryModels(_m *User) *ModelQuery {
|
|
query := (&ModelClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(user.Table, user.FieldID, id),
|
|
sqlgraph.To(model.Table, model.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, user.ModelsTable, user.ModelsColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryImages queries the images edge of a User.
|
|
func (c *UserClient) QueryImages(_m *User) *ImageQuery {
|
|
query := (&ImageClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(user.Table, user.FieldID, id),
|
|
sqlgraph.To(image.Table, image.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, user.ImagesTable, user.ImagesColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryHosts queries the hosts edge of a User.
|
|
func (c *UserClient) QueryHosts(_m *User) *HostQuery {
|
|
query := (&HostClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(user.Table, user.FieldID, id),
|
|
sqlgraph.To(host.Table, host.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, user.HostsTable, user.HostsColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryVms queries the vms edge of a User.
|
|
func (c *UserClient) QueryVms(_m *User) *VirtualMachineQuery {
|
|
query := (&VirtualMachineClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(user.Table, user.FieldID, id),
|
|
sqlgraph.To(virtualmachine.Table, virtualmachine.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, user.VmsTable, user.VmsColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryTasks queries the tasks edge of a User.
|
|
func (c *UserClient) QueryTasks(_m *User) *TaskQuery {
|
|
query := (&TaskClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(user.Table, user.FieldID, id),
|
|
sqlgraph.To(task.Table, task.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, user.TasksTable, user.TasksColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryGitIdentities queries the git_identities edge of a User.
|
|
func (c *UserClient) QueryGitIdentities(_m *User) *GitIdentityQuery {
|
|
query := (&GitIdentityClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(user.Table, user.FieldID, id),
|
|
sqlgraph.To(gitidentity.Table, gitidentity.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, user.GitIdentitiesTable, user.GitIdentitiesColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryProjects queries the projects edge of a User.
|
|
func (c *UserClient) QueryProjects(_m *User) *ProjectQuery {
|
|
query := (&ProjectClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(user.Table, user.FieldID, id),
|
|
sqlgraph.To(project.Table, project.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, user.ProjectsTable, user.ProjectsColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryProjectIssues queries the project_issues edge of a User.
|
|
func (c *UserClient) QueryProjectIssues(_m *User) *ProjectIssueQuery {
|
|
query := (&ProjectIssueClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(user.Table, user.FieldID, id),
|
|
sqlgraph.To(projectissue.Table, projectissue.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, user.ProjectIssuesTable, user.ProjectIssuesColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryAssignedIssues queries the assigned_issues edge of a User.
|
|
func (c *UserClient) QueryAssignedIssues(_m *User) *ProjectIssueQuery {
|
|
query := (&ProjectIssueClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(user.Table, user.FieldID, id),
|
|
sqlgraph.To(projectissue.Table, projectissue.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, user.AssignedIssuesTable, user.AssignedIssuesColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryProjectCollaborators queries the project_collaborators edge of a User.
|
|
func (c *UserClient) QueryProjectCollaborators(_m *User) *ProjectCollaboratorQuery {
|
|
query := (&ProjectCollaboratorClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(user.Table, user.FieldID, id),
|
|
sqlgraph.To(projectcollaborator.Table, projectcollaborator.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, user.ProjectCollaboratorsTable, user.ProjectCollaboratorsColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryProjectIssueComments queries the project_issue_comments edge of a User.
|
|
func (c *UserClient) QueryProjectIssueComments(_m *User) *ProjectIssueCommentQuery {
|
|
query := (&ProjectIssueCommentClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(user.Table, user.FieldID, id),
|
|
sqlgraph.To(projectissuecomment.Table, projectissuecomment.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, user.ProjectIssueCommentsTable, user.ProjectIssueCommentsColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryGitBots queries the git_bots edge of a User.
|
|
func (c *UserClient) QueryGitBots(_m *User) *GitBotQuery {
|
|
query := (&GitBotClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(user.Table, user.FieldID, id),
|
|
sqlgraph.To(gitbot.Table, gitbot.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2M, false, user.GitBotsTable, user.GitBotsPrimaryKey...),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryTeamMembers queries the team_members edge of a User.
|
|
func (c *UserClient) QueryTeamMembers(_m *User) *TeamMemberQuery {
|
|
query := (&TeamMemberClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(user.Table, user.FieldID, id),
|
|
sqlgraph.To(teammember.Table, teammember.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, true, user.TeamMembersTable, user.TeamMembersColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryTeamGroupMembers queries the team_group_members edge of a User.
|
|
func (c *UserClient) QueryTeamGroupMembers(_m *User) *TeamGroupMemberQuery {
|
|
query := (&TeamGroupMemberClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(user.Table, user.FieldID, id),
|
|
sqlgraph.To(teamgroupmember.Table, teamgroupmember.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, true, user.TeamGroupMembersTable, user.TeamGroupMembersColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryGitBotUsers queries the git_bot_users edge of a User.
|
|
func (c *UserClient) QueryGitBotUsers(_m *User) *GitBotUserQuery {
|
|
query := (&GitBotUserClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(user.Table, user.FieldID, id),
|
|
sqlgraph.To(gitbotuser.Table, gitbotuser.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, true, user.GitBotUsersTable, user.GitBotUsersColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *UserClient) Hooks() []Hook {
|
|
hooks := c.hooks.User
|
|
return append(hooks[:len(hooks):len(hooks)], user.Hooks[:]...)
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *UserClient) Interceptors() []Interceptor {
|
|
inters := c.inters.User
|
|
return append(inters[:len(inters):len(inters)], user.Interceptors[:]...)
|
|
}
|
|
|
|
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("db: unknown User mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// UserIdentityClient is a client for the UserIdentity schema.
|
|
type UserIdentityClient struct {
|
|
config
|
|
}
|
|
|
|
// NewUserIdentityClient returns a client for the UserIdentity from the given config.
|
|
func NewUserIdentityClient(c config) *UserIdentityClient {
|
|
return &UserIdentityClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `useridentity.Hooks(f(g(h())))`.
|
|
func (c *UserIdentityClient) Use(hooks ...Hook) {
|
|
c.hooks.UserIdentity = append(c.hooks.UserIdentity, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `useridentity.Intercept(f(g(h())))`.
|
|
func (c *UserIdentityClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.UserIdentity = append(c.inters.UserIdentity, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a UserIdentity entity.
|
|
func (c *UserIdentityClient) Create() *UserIdentityCreate {
|
|
mutation := newUserIdentityMutation(c.config, OpCreate)
|
|
return &UserIdentityCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of UserIdentity entities.
|
|
func (c *UserIdentityClient) CreateBulk(builders ...*UserIdentityCreate) *UserIdentityCreateBulk {
|
|
return &UserIdentityCreateBulk{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 *UserIdentityClient) MapCreateBulk(slice any, setFunc func(*UserIdentityCreate, int)) *UserIdentityCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &UserIdentityCreateBulk{err: fmt.Errorf("calling to UserIdentityClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*UserIdentityCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &UserIdentityCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for UserIdentity.
|
|
func (c *UserIdentityClient) Update() *UserIdentityUpdate {
|
|
mutation := newUserIdentityMutation(c.config, OpUpdate)
|
|
return &UserIdentityUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *UserIdentityClient) UpdateOne(_m *UserIdentity) *UserIdentityUpdateOne {
|
|
mutation := newUserIdentityMutation(c.config, OpUpdateOne, withUserIdentity(_m))
|
|
return &UserIdentityUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *UserIdentityClient) UpdateOneID(id uuid.UUID) *UserIdentityUpdateOne {
|
|
mutation := newUserIdentityMutation(c.config, OpUpdateOne, withUserIdentityID(id))
|
|
return &UserIdentityUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for UserIdentity.
|
|
func (c *UserIdentityClient) Delete() *UserIdentityDelete {
|
|
mutation := newUserIdentityMutation(c.config, OpDelete)
|
|
return &UserIdentityDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *UserIdentityClient) DeleteOne(_m *UserIdentity) *UserIdentityDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *UserIdentityClient) DeleteOneID(id uuid.UUID) *UserIdentityDeleteOne {
|
|
builder := c.Delete().Where(useridentity.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &UserIdentityDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for UserIdentity.
|
|
func (c *UserIdentityClient) Query() *UserIdentityQuery {
|
|
return &UserIdentityQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeUserIdentity},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a UserIdentity entity by its id.
|
|
func (c *UserIdentityClient) Get(ctx context.Context, id uuid.UUID) (*UserIdentity, error) {
|
|
return c.Query().Where(useridentity.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *UserIdentityClient) GetX(ctx context.Context, id uuid.UUID) *UserIdentity {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// QueryUser queries the user edge of a UserIdentity.
|
|
func (c *UserIdentityClient) QueryUser(_m *UserIdentity) *UserQuery {
|
|
query := (&UserClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(useridentity.Table, useridentity.FieldID, id),
|
|
sqlgraph.To(user.Table, user.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, useridentity.UserTable, useridentity.UserColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *UserIdentityClient) Hooks() []Hook {
|
|
hooks := c.hooks.UserIdentity
|
|
return append(hooks[:len(hooks):len(hooks)], useridentity.Hooks[:]...)
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *UserIdentityClient) Interceptors() []Interceptor {
|
|
inters := c.inters.UserIdentity
|
|
return append(inters[:len(inters):len(inters)], useridentity.Interceptors[:]...)
|
|
}
|
|
|
|
func (c *UserIdentityClient) mutate(ctx context.Context, m *UserIdentityMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&UserIdentityCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&UserIdentityUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&UserIdentityUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&UserIdentityDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown UserIdentity mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// VirtualMachineClient is a client for the VirtualMachine schema.
|
|
type VirtualMachineClient struct {
|
|
config
|
|
}
|
|
|
|
// NewVirtualMachineClient returns a client for the VirtualMachine from the given config.
|
|
func NewVirtualMachineClient(c config) *VirtualMachineClient {
|
|
return &VirtualMachineClient{config: c}
|
|
}
|
|
|
|
// Use adds a list of mutation hooks to the hooks stack.
|
|
// A call to `Use(f, g, h)` equals to `virtualmachine.Hooks(f(g(h())))`.
|
|
func (c *VirtualMachineClient) Use(hooks ...Hook) {
|
|
c.hooks.VirtualMachine = append(c.hooks.VirtualMachine, hooks...)
|
|
}
|
|
|
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
|
// A call to `Intercept(f, g, h)` equals to `virtualmachine.Intercept(f(g(h())))`.
|
|
func (c *VirtualMachineClient) Intercept(interceptors ...Interceptor) {
|
|
c.inters.VirtualMachine = append(c.inters.VirtualMachine, interceptors...)
|
|
}
|
|
|
|
// Create returns a builder for creating a VirtualMachine entity.
|
|
func (c *VirtualMachineClient) Create() *VirtualMachineCreate {
|
|
mutation := newVirtualMachineMutation(c.config, OpCreate)
|
|
return &VirtualMachineCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// CreateBulk returns a builder for creating a bulk of VirtualMachine entities.
|
|
func (c *VirtualMachineClient) CreateBulk(builders ...*VirtualMachineCreate) *VirtualMachineCreateBulk {
|
|
return &VirtualMachineCreateBulk{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 *VirtualMachineClient) MapCreateBulk(slice any, setFunc func(*VirtualMachineCreate, int)) *VirtualMachineCreateBulk {
|
|
rv := reflect.ValueOf(slice)
|
|
if rv.Kind() != reflect.Slice {
|
|
return &VirtualMachineCreateBulk{err: fmt.Errorf("calling to VirtualMachineClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
|
}
|
|
builders := make([]*VirtualMachineCreate, rv.Len())
|
|
for i := 0; i < rv.Len(); i++ {
|
|
builders[i] = c.Create()
|
|
setFunc(builders[i], i)
|
|
}
|
|
return &VirtualMachineCreateBulk{config: c.config, builders: builders}
|
|
}
|
|
|
|
// Update returns an update builder for VirtualMachine.
|
|
func (c *VirtualMachineClient) Update() *VirtualMachineUpdate {
|
|
mutation := newVirtualMachineMutation(c.config, OpUpdate)
|
|
return &VirtualMachineUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOne returns an update builder for the given entity.
|
|
func (c *VirtualMachineClient) UpdateOne(_m *VirtualMachine) *VirtualMachineUpdateOne {
|
|
mutation := newVirtualMachineMutation(c.config, OpUpdateOne, withVirtualMachine(_m))
|
|
return &VirtualMachineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// UpdateOneID returns an update builder for the given id.
|
|
func (c *VirtualMachineClient) UpdateOneID(id string) *VirtualMachineUpdateOne {
|
|
mutation := newVirtualMachineMutation(c.config, OpUpdateOne, withVirtualMachineID(id))
|
|
return &VirtualMachineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// Delete returns a delete builder for VirtualMachine.
|
|
func (c *VirtualMachineClient) Delete() *VirtualMachineDelete {
|
|
mutation := newVirtualMachineMutation(c.config, OpDelete)
|
|
return &VirtualMachineDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
|
}
|
|
|
|
// DeleteOne returns a builder for deleting the given entity.
|
|
func (c *VirtualMachineClient) DeleteOne(_m *VirtualMachine) *VirtualMachineDeleteOne {
|
|
return c.DeleteOneID(_m.ID)
|
|
}
|
|
|
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
|
func (c *VirtualMachineClient) DeleteOneID(id string) *VirtualMachineDeleteOne {
|
|
builder := c.Delete().Where(virtualmachine.ID(id))
|
|
builder.mutation.id = &id
|
|
builder.mutation.op = OpDeleteOne
|
|
return &VirtualMachineDeleteOne{builder}
|
|
}
|
|
|
|
// Query returns a query builder for VirtualMachine.
|
|
func (c *VirtualMachineClient) Query() *VirtualMachineQuery {
|
|
return &VirtualMachineQuery{
|
|
config: c.config,
|
|
ctx: &QueryContext{Type: TypeVirtualMachine},
|
|
inters: c.Interceptors(),
|
|
}
|
|
}
|
|
|
|
// Get returns a VirtualMachine entity by its id.
|
|
func (c *VirtualMachineClient) Get(ctx context.Context, id string) (*VirtualMachine, error) {
|
|
return c.Query().Where(virtualmachine.ID(id)).Only(ctx)
|
|
}
|
|
|
|
// GetX is like Get, but panics if an error occurs.
|
|
func (c *VirtualMachineClient) GetX(ctx context.Context, id string) *VirtualMachine {
|
|
obj, err := c.Get(ctx, id)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return obj
|
|
}
|
|
|
|
// QueryHost queries the host edge of a VirtualMachine.
|
|
func (c *VirtualMachineClient) QueryHost(_m *VirtualMachine) *HostQuery {
|
|
query := (&HostClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(virtualmachine.Table, virtualmachine.FieldID, id),
|
|
sqlgraph.To(host.Table, host.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, virtualmachine.HostTable, virtualmachine.HostColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryModel queries the model edge of a VirtualMachine.
|
|
func (c *VirtualMachineClient) QueryModel(_m *VirtualMachine) *ModelQuery {
|
|
query := (&ModelClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(virtualmachine.Table, virtualmachine.FieldID, id),
|
|
sqlgraph.To(model.Table, model.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, virtualmachine.ModelTable, virtualmachine.ModelColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryUser queries the user edge of a VirtualMachine.
|
|
func (c *VirtualMachineClient) QueryUser(_m *VirtualMachine) *UserQuery {
|
|
query := (&UserClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(virtualmachine.Table, virtualmachine.FieldID, id),
|
|
sqlgraph.To(user.Table, user.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, virtualmachine.UserTable, virtualmachine.UserColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryTasks queries the tasks edge of a VirtualMachine.
|
|
func (c *VirtualMachineClient) QueryTasks(_m *VirtualMachine) *TaskQuery {
|
|
query := (&TaskClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(virtualmachine.Table, virtualmachine.FieldID, id),
|
|
sqlgraph.To(task.Table, task.FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2M, false, virtualmachine.TasksTable, virtualmachine.TasksPrimaryKey...),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// QueryTaskVms queries the task_vms edge of a VirtualMachine.
|
|
func (c *VirtualMachineClient) QueryTaskVms(_m *VirtualMachine) *TaskVirtualMachineQuery {
|
|
query := (&TaskVirtualMachineClient{config: c.config}).Query()
|
|
query.path = func(context.Context) (fromV *sql.Selector, _ error) {
|
|
id := _m.ID
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(virtualmachine.Table, virtualmachine.FieldID, id),
|
|
sqlgraph.To(taskvirtualmachine.Table, taskvirtualmachine.FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, true, virtualmachine.TaskVmsTable, virtualmachine.TaskVmsColumn),
|
|
)
|
|
fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
|
|
return fromV, nil
|
|
}
|
|
return query
|
|
}
|
|
|
|
// Hooks returns the client hooks.
|
|
func (c *VirtualMachineClient) Hooks() []Hook {
|
|
hooks := c.hooks.VirtualMachine
|
|
return append(hooks[:len(hooks):len(hooks)], virtualmachine.Hooks[:]...)
|
|
}
|
|
|
|
// Interceptors returns the client interceptors.
|
|
func (c *VirtualMachineClient) Interceptors() []Interceptor {
|
|
inters := c.inters.VirtualMachine
|
|
return append(inters[:len(inters):len(inters)], virtualmachine.Interceptors[:]...)
|
|
}
|
|
|
|
func (c *VirtualMachineClient) mutate(ctx context.Context, m *VirtualMachineMutation) (Value, error) {
|
|
switch m.Op() {
|
|
case OpCreate:
|
|
return (&VirtualMachineCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdate:
|
|
return (&VirtualMachineUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpUpdateOne:
|
|
return (&VirtualMachineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
|
case OpDelete, OpDeleteOne:
|
|
return (&VirtualMachineDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("db: unknown VirtualMachine mutation op: %q", m.Op())
|
|
}
|
|
}
|
|
|
|
// hooks and interceptors per client, for fast access.
|
|
type (
|
|
hooks struct {
|
|
Audit, GitBot, GitBotTask, GitBotUser, GitIdentity, Host, Image, Model,
|
|
NotifyChannel, NotifySendLog, NotifySubscription, Project, ProjectCollaborator,
|
|
ProjectGitBot, ProjectIssue, ProjectIssueComment, ProjectTask, Task,
|
|
TaskVirtualMachine, Team, TeamGroup, TeamGroupHost, TeamGroupImage,
|
|
TeamGroupMember, TeamGroupModel, TeamHost, TeamImage, TeamMember, TeamModel,
|
|
User, UserIdentity, VirtualMachine []ent.Hook
|
|
}
|
|
inters struct {
|
|
Audit, GitBot, GitBotTask, GitBotUser, GitIdentity, Host, Image, Model,
|
|
NotifyChannel, NotifySendLog, NotifySubscription, Project, ProjectCollaborator,
|
|
ProjectGitBot, ProjectIssue, ProjectIssueComment, ProjectTask, Task,
|
|
TaskVirtualMachine, Team, TeamGroup, TeamGroupHost, TeamGroupImage,
|
|
TeamGroupMember, TeamGroupModel, TeamHost, TeamImage, TeamMember, TeamModel,
|
|
User, UserIdentity, VirtualMachine []ent.Interceptor
|
|
}
|
|
)
|
|
|
|
// ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it.
|
|
// See, database/sql#DB.ExecContext for more information.
|
|
func (c *config) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error) {
|
|
ex, ok := c.driver.(interface {
|
|
ExecContext(context.Context, string, ...any) (stdsql.Result, error)
|
|
})
|
|
if !ok {
|
|
return nil, fmt.Errorf("Driver.ExecContext is not supported")
|
|
}
|
|
return ex.ExecContext(ctx, query, args...)
|
|
}
|
|
|
|
// QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it.
|
|
// See, database/sql#DB.QueryContext for more information.
|
|
func (c *config) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error) {
|
|
q, ok := c.driver.(interface {
|
|
QueryContext(context.Context, string, ...any) (*stdsql.Rows, error)
|
|
})
|
|
if !ok {
|
|
return nil, fmt.Errorf("Driver.QueryContext is not supported")
|
|
}
|
|
return q.QueryContext(ctx, query, args...)
|
|
}
|