561 lines
17 KiB
Go
561 lines
17 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
"mingyang-admin-app-rpc/ent/userloginlog"
|
|
"time"
|
|
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
"entgo.io/ent/schema/field"
|
|
)
|
|
|
|
// UserLoginLogCreate is the builder for creating a UserLoginLog entity.
|
|
type UserLoginLogCreate struct {
|
|
config
|
|
mutation *UserLoginLogMutation
|
|
hooks []Hook
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (_c *UserLoginLogCreate) SetCreatedAt(v time.Time) *UserLoginLogCreate {
|
|
_c.mutation.SetCreatedAt(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
|
|
func (_c *UserLoginLogCreate) SetNillableCreatedAt(v *time.Time) *UserLoginLogCreate {
|
|
if v != nil {
|
|
_c.SetCreatedAt(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (_c *UserLoginLogCreate) SetUpdatedAt(v time.Time) *UserLoginLogCreate {
|
|
_c.mutation.SetUpdatedAt(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
|
|
func (_c *UserLoginLogCreate) SetNillableUpdatedAt(v *time.Time) *UserLoginLogCreate {
|
|
if v != nil {
|
|
_c.SetUpdatedAt(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetStatus sets the "status" field.
|
|
func (_c *UserLoginLogCreate) SetStatus(v uint8) *UserLoginLogCreate {
|
|
_c.mutation.SetStatus(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableStatus sets the "status" field if the given value is not nil.
|
|
func (_c *UserLoginLogCreate) SetNillableStatus(v *uint8) *UserLoginLogCreate {
|
|
if v != nil {
|
|
_c.SetStatus(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetTenantID sets the "tenant_id" field.
|
|
func (_c *UserLoginLogCreate) SetTenantID(v uint64) *UserLoginLogCreate {
|
|
_c.mutation.SetTenantID(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableTenantID sets the "tenant_id" field if the given value is not nil.
|
|
func (_c *UserLoginLogCreate) SetNillableTenantID(v *uint64) *UserLoginLogCreate {
|
|
if v != nil {
|
|
_c.SetTenantID(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetDeletedAt sets the "deleted_at" field.
|
|
func (_c *UserLoginLogCreate) SetDeletedAt(v time.Time) *UserLoginLogCreate {
|
|
_c.mutation.SetDeletedAt(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
|
|
func (_c *UserLoginLogCreate) SetNillableDeletedAt(v *time.Time) *UserLoginLogCreate {
|
|
if v != nil {
|
|
_c.SetDeletedAt(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetUserID sets the "user_id" field.
|
|
func (_c *UserLoginLogCreate) SetUserID(v uint64) *UserLoginLogCreate {
|
|
_c.mutation.SetUserID(v)
|
|
return _c
|
|
}
|
|
|
|
// SetLoginTime sets the "login_time" field.
|
|
func (_c *UserLoginLogCreate) SetLoginTime(v time.Time) *UserLoginLogCreate {
|
|
_c.mutation.SetLoginTime(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableLoginTime sets the "login_time" field if the given value is not nil.
|
|
func (_c *UserLoginLogCreate) SetNillableLoginTime(v *time.Time) *UserLoginLogCreate {
|
|
if v != nil {
|
|
_c.SetLoginTime(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetLoginIP sets the "login_ip" field.
|
|
func (_c *UserLoginLogCreate) SetLoginIP(v string) *UserLoginLogCreate {
|
|
_c.mutation.SetLoginIP(v)
|
|
return _c
|
|
}
|
|
|
|
// SetLoginLocation sets the "login_location" field.
|
|
func (_c *UserLoginLogCreate) SetLoginLocation(v string) *UserLoginLogCreate {
|
|
_c.mutation.SetLoginLocation(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableLoginLocation sets the "login_location" field if the given value is not nil.
|
|
func (_c *UserLoginLogCreate) SetNillableLoginLocation(v *string) *UserLoginLogCreate {
|
|
if v != nil {
|
|
_c.SetLoginLocation(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetLoginType sets the "login_type" field.
|
|
func (_c *UserLoginLogCreate) SetLoginType(v userloginlog.LoginType) *UserLoginLogCreate {
|
|
_c.mutation.SetLoginType(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableLoginType sets the "login_type" field if the given value is not nil.
|
|
func (_c *UserLoginLogCreate) SetNillableLoginType(v *userloginlog.LoginType) *UserLoginLogCreate {
|
|
if v != nil {
|
|
_c.SetLoginType(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetLoginPlatform sets the "login_platform" field.
|
|
func (_c *UserLoginLogCreate) SetLoginPlatform(v userloginlog.LoginPlatform) *UserLoginLogCreate {
|
|
_c.mutation.SetLoginPlatform(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableLoginPlatform sets the "login_platform" field if the given value is not nil.
|
|
func (_c *UserLoginLogCreate) SetNillableLoginPlatform(v *userloginlog.LoginPlatform) *UserLoginLogCreate {
|
|
if v != nil {
|
|
_c.SetLoginPlatform(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetLoginResult sets the "login_result" field.
|
|
func (_c *UserLoginLogCreate) SetLoginResult(v bool) *UserLoginLogCreate {
|
|
_c.mutation.SetLoginResult(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableLoginResult sets the "login_result" field if the given value is not nil.
|
|
func (_c *UserLoginLogCreate) SetNillableLoginResult(v *bool) *UserLoginLogCreate {
|
|
if v != nil {
|
|
_c.SetLoginResult(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetFailureReason sets the "failure_reason" field.
|
|
func (_c *UserLoginLogCreate) SetFailureReason(v string) *UserLoginLogCreate {
|
|
_c.mutation.SetFailureReason(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableFailureReason sets the "failure_reason" field if the given value is not nil.
|
|
func (_c *UserLoginLogCreate) SetNillableFailureReason(v *string) *UserLoginLogCreate {
|
|
if v != nil {
|
|
_c.SetFailureReason(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetSessionID sets the "session_id" field.
|
|
func (_c *UserLoginLogCreate) SetSessionID(v string) *UserLoginLogCreate {
|
|
_c.mutation.SetSessionID(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableSessionID sets the "session_id" field if the given value is not nil.
|
|
func (_c *UserLoginLogCreate) SetNillableSessionID(v *string) *UserLoginLogCreate {
|
|
if v != nil {
|
|
_c.SetSessionID(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetLatencyMs sets the "latency_ms" field.
|
|
func (_c *UserLoginLogCreate) SetLatencyMs(v int) *UserLoginLogCreate {
|
|
_c.mutation.SetLatencyMs(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableLatencyMs sets the "latency_ms" field if the given value is not nil.
|
|
func (_c *UserLoginLogCreate) SetNillableLatencyMs(v *int) *UserLoginLogCreate {
|
|
if v != nil {
|
|
_c.SetLatencyMs(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetAuthID sets the "auth_id" field.
|
|
func (_c *UserLoginLogCreate) SetAuthID(v uint64) *UserLoginLogCreate {
|
|
_c.mutation.SetAuthID(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableAuthID sets the "auth_id" field if the given value is not nil.
|
|
func (_c *UserLoginLogCreate) SetNillableAuthID(v *uint64) *UserLoginLogCreate {
|
|
if v != nil {
|
|
_c.SetAuthID(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetAdditionalData sets the "additional_data" field.
|
|
func (_c *UserLoginLogCreate) SetAdditionalData(v map[string]interface{}) *UserLoginLogCreate {
|
|
_c.mutation.SetAdditionalData(v)
|
|
return _c
|
|
}
|
|
|
|
// SetID sets the "id" field.
|
|
func (_c *UserLoginLogCreate) SetID(v uint64) *UserLoginLogCreate {
|
|
_c.mutation.SetID(v)
|
|
return _c
|
|
}
|
|
|
|
// Mutation returns the UserLoginLogMutation object of the builder.
|
|
func (_c *UserLoginLogCreate) Mutation() *UserLoginLogMutation {
|
|
return _c.mutation
|
|
}
|
|
|
|
// Save creates the UserLoginLog in the database.
|
|
func (_c *UserLoginLogCreate) Save(ctx context.Context) (*UserLoginLog, error) {
|
|
_c.defaults()
|
|
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
|
|
}
|
|
|
|
// SaveX calls Save and panics if Save returns an error.
|
|
func (_c *UserLoginLogCreate) SaveX(ctx context.Context) *UserLoginLog {
|
|
v, err := _c.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return v
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (_c *UserLoginLogCreate) Exec(ctx context.Context) error {
|
|
_, err := _c.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_c *UserLoginLogCreate) ExecX(ctx context.Context) {
|
|
if err := _c.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
// defaults sets the default values of the builder before save.
|
|
func (_c *UserLoginLogCreate) defaults() {
|
|
if _, ok := _c.mutation.CreatedAt(); !ok {
|
|
v := userloginlog.DefaultCreatedAt()
|
|
_c.mutation.SetCreatedAt(v)
|
|
}
|
|
if _, ok := _c.mutation.UpdatedAt(); !ok {
|
|
v := userloginlog.DefaultUpdatedAt()
|
|
_c.mutation.SetUpdatedAt(v)
|
|
}
|
|
if _, ok := _c.mutation.Status(); !ok {
|
|
v := userloginlog.DefaultStatus
|
|
_c.mutation.SetStatus(v)
|
|
}
|
|
if _, ok := _c.mutation.TenantID(); !ok {
|
|
v := userloginlog.DefaultTenantID
|
|
_c.mutation.SetTenantID(v)
|
|
}
|
|
if _, ok := _c.mutation.LoginTime(); !ok {
|
|
v := userloginlog.DefaultLoginTime()
|
|
_c.mutation.SetLoginTime(v)
|
|
}
|
|
if _, ok := _c.mutation.LoginType(); !ok {
|
|
v := userloginlog.DefaultLoginType
|
|
_c.mutation.SetLoginType(v)
|
|
}
|
|
if _, ok := _c.mutation.LoginPlatform(); !ok {
|
|
v := userloginlog.DefaultLoginPlatform
|
|
_c.mutation.SetLoginPlatform(v)
|
|
}
|
|
if _, ok := _c.mutation.LoginResult(); !ok {
|
|
v := userloginlog.DefaultLoginResult
|
|
_c.mutation.SetLoginResult(v)
|
|
}
|
|
}
|
|
|
|
// check runs all checks and user-defined validators on the builder.
|
|
func (_c *UserLoginLogCreate) check() error {
|
|
if _, ok := _c.mutation.CreatedAt(); !ok {
|
|
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "UserLoginLog.created_at"`)}
|
|
}
|
|
if _, ok := _c.mutation.UpdatedAt(); !ok {
|
|
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "UserLoginLog.updated_at"`)}
|
|
}
|
|
if _, ok := _c.mutation.TenantID(); !ok {
|
|
return &ValidationError{Name: "tenant_id", err: errors.New(`ent: missing required field "UserLoginLog.tenant_id"`)}
|
|
}
|
|
if _, ok := _c.mutation.UserID(); !ok {
|
|
return &ValidationError{Name: "user_id", err: errors.New(`ent: missing required field "UserLoginLog.user_id"`)}
|
|
}
|
|
if _, ok := _c.mutation.LoginTime(); !ok {
|
|
return &ValidationError{Name: "login_time", err: errors.New(`ent: missing required field "UserLoginLog.login_time"`)}
|
|
}
|
|
if _, ok := _c.mutation.LoginIP(); !ok {
|
|
return &ValidationError{Name: "login_ip", err: errors.New(`ent: missing required field "UserLoginLog.login_ip"`)}
|
|
}
|
|
if v, ok := _c.mutation.LoginIP(); ok {
|
|
if err := userloginlog.LoginIPValidator(v); err != nil {
|
|
return &ValidationError{Name: "login_ip", err: fmt.Errorf(`ent: validator failed for field "UserLoginLog.login_ip": %w`, err)}
|
|
}
|
|
}
|
|
if v, ok := _c.mutation.LoginLocation(); ok {
|
|
if err := userloginlog.LoginLocationValidator(v); err != nil {
|
|
return &ValidationError{Name: "login_location", err: fmt.Errorf(`ent: validator failed for field "UserLoginLog.login_location": %w`, err)}
|
|
}
|
|
}
|
|
if _, ok := _c.mutation.LoginType(); !ok {
|
|
return &ValidationError{Name: "login_type", err: errors.New(`ent: missing required field "UserLoginLog.login_type"`)}
|
|
}
|
|
if v, ok := _c.mutation.LoginType(); ok {
|
|
if err := userloginlog.LoginTypeValidator(v); err != nil {
|
|
return &ValidationError{Name: "login_type", err: fmt.Errorf(`ent: validator failed for field "UserLoginLog.login_type": %w`, err)}
|
|
}
|
|
}
|
|
if _, ok := _c.mutation.LoginPlatform(); !ok {
|
|
return &ValidationError{Name: "login_platform", err: errors.New(`ent: missing required field "UserLoginLog.login_platform"`)}
|
|
}
|
|
if v, ok := _c.mutation.LoginPlatform(); ok {
|
|
if err := userloginlog.LoginPlatformValidator(v); err != nil {
|
|
return &ValidationError{Name: "login_platform", err: fmt.Errorf(`ent: validator failed for field "UserLoginLog.login_platform": %w`, err)}
|
|
}
|
|
}
|
|
if _, ok := _c.mutation.LoginResult(); !ok {
|
|
return &ValidationError{Name: "login_result", err: errors.New(`ent: missing required field "UserLoginLog.login_result"`)}
|
|
}
|
|
if v, ok := _c.mutation.FailureReason(); ok {
|
|
if err := userloginlog.FailureReasonValidator(v); err != nil {
|
|
return &ValidationError{Name: "failure_reason", err: fmt.Errorf(`ent: validator failed for field "UserLoginLog.failure_reason": %w`, err)}
|
|
}
|
|
}
|
|
if v, ok := _c.mutation.SessionID(); ok {
|
|
if err := userloginlog.SessionIDValidator(v); err != nil {
|
|
return &ValidationError{Name: "session_id", err: fmt.Errorf(`ent: validator failed for field "UserLoginLog.session_id": %w`, err)}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (_c *UserLoginLogCreate) sqlSave(ctx context.Context) (*UserLoginLog, error) {
|
|
if err := _c.check(); err != nil {
|
|
return nil, err
|
|
}
|
|
_node, _spec := _c.createSpec()
|
|
if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
|
|
if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
return nil, err
|
|
}
|
|
if _spec.ID.Value != _node.ID {
|
|
id := _spec.ID.Value.(int64)
|
|
_node.ID = uint64(id)
|
|
}
|
|
_c.mutation.id = &_node.ID
|
|
_c.mutation.done = true
|
|
return _node, nil
|
|
}
|
|
|
|
func (_c *UserLoginLogCreate) createSpec() (*UserLoginLog, *sqlgraph.CreateSpec) {
|
|
var (
|
|
_node = &UserLoginLog{config: _c.config}
|
|
_spec = sqlgraph.NewCreateSpec(userloginlog.Table, sqlgraph.NewFieldSpec(userloginlog.FieldID, field.TypeUint64))
|
|
)
|
|
if id, ok := _c.mutation.ID(); ok {
|
|
_node.ID = id
|
|
_spec.ID.Value = id
|
|
}
|
|
if value, ok := _c.mutation.CreatedAt(); ok {
|
|
_spec.SetField(userloginlog.FieldCreatedAt, field.TypeTime, value)
|
|
_node.CreatedAt = value
|
|
}
|
|
if value, ok := _c.mutation.UpdatedAt(); ok {
|
|
_spec.SetField(userloginlog.FieldUpdatedAt, field.TypeTime, value)
|
|
_node.UpdatedAt = value
|
|
}
|
|
if value, ok := _c.mutation.Status(); ok {
|
|
_spec.SetField(userloginlog.FieldStatus, field.TypeUint8, value)
|
|
_node.Status = value
|
|
}
|
|
if value, ok := _c.mutation.TenantID(); ok {
|
|
_spec.SetField(userloginlog.FieldTenantID, field.TypeUint64, value)
|
|
_node.TenantID = value
|
|
}
|
|
if value, ok := _c.mutation.DeletedAt(); ok {
|
|
_spec.SetField(userloginlog.FieldDeletedAt, field.TypeTime, value)
|
|
_node.DeletedAt = value
|
|
}
|
|
if value, ok := _c.mutation.UserID(); ok {
|
|
_spec.SetField(userloginlog.FieldUserID, field.TypeUint64, value)
|
|
_node.UserID = value
|
|
}
|
|
if value, ok := _c.mutation.LoginTime(); ok {
|
|
_spec.SetField(userloginlog.FieldLoginTime, field.TypeTime, value)
|
|
_node.LoginTime = value
|
|
}
|
|
if value, ok := _c.mutation.LoginIP(); ok {
|
|
_spec.SetField(userloginlog.FieldLoginIP, field.TypeString, value)
|
|
_node.LoginIP = value
|
|
}
|
|
if value, ok := _c.mutation.LoginLocation(); ok {
|
|
_spec.SetField(userloginlog.FieldLoginLocation, field.TypeString, value)
|
|
_node.LoginLocation = value
|
|
}
|
|
if value, ok := _c.mutation.LoginType(); ok {
|
|
_spec.SetField(userloginlog.FieldLoginType, field.TypeEnum, value)
|
|
_node.LoginType = value
|
|
}
|
|
if value, ok := _c.mutation.LoginPlatform(); ok {
|
|
_spec.SetField(userloginlog.FieldLoginPlatform, field.TypeEnum, value)
|
|
_node.LoginPlatform = value
|
|
}
|
|
if value, ok := _c.mutation.LoginResult(); ok {
|
|
_spec.SetField(userloginlog.FieldLoginResult, field.TypeBool, value)
|
|
_node.LoginResult = value
|
|
}
|
|
if value, ok := _c.mutation.FailureReason(); ok {
|
|
_spec.SetField(userloginlog.FieldFailureReason, field.TypeString, value)
|
|
_node.FailureReason = value
|
|
}
|
|
if value, ok := _c.mutation.SessionID(); ok {
|
|
_spec.SetField(userloginlog.FieldSessionID, field.TypeString, value)
|
|
_node.SessionID = value
|
|
}
|
|
if value, ok := _c.mutation.LatencyMs(); ok {
|
|
_spec.SetField(userloginlog.FieldLatencyMs, field.TypeInt, value)
|
|
_node.LatencyMs = value
|
|
}
|
|
if value, ok := _c.mutation.AuthID(); ok {
|
|
_spec.SetField(userloginlog.FieldAuthID, field.TypeUint64, value)
|
|
_node.AuthID = value
|
|
}
|
|
if value, ok := _c.mutation.AdditionalData(); ok {
|
|
_spec.SetField(userloginlog.FieldAdditionalData, field.TypeJSON, value)
|
|
_node.AdditionalData = value
|
|
}
|
|
return _node, _spec
|
|
}
|
|
|
|
// UserLoginLogCreateBulk is the builder for creating many UserLoginLog entities in bulk.
|
|
type UserLoginLogCreateBulk struct {
|
|
config
|
|
err error
|
|
builders []*UserLoginLogCreate
|
|
}
|
|
|
|
// Save creates the UserLoginLog entities in the database.
|
|
func (_c *UserLoginLogCreateBulk) Save(ctx context.Context) ([]*UserLoginLog, error) {
|
|
if _c.err != nil {
|
|
return nil, _c.err
|
|
}
|
|
specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
|
|
nodes := make([]*UserLoginLog, len(_c.builders))
|
|
mutators := make([]Mutator, len(_c.builders))
|
|
for i := range _c.builders {
|
|
func(i int, root context.Context) {
|
|
builder := _c.builders[i]
|
|
builder.defaults()
|
|
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
|
mutation, ok := m.(*UserLoginLogMutation)
|
|
if !ok {
|
|
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
|
}
|
|
if err := builder.check(); err != nil {
|
|
return nil, err
|
|
}
|
|
builder.mutation = mutation
|
|
var err error
|
|
nodes[i], specs[i] = builder.createSpec()
|
|
if i < len(mutators)-1 {
|
|
_, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
|
|
} else {
|
|
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
|
|
// Invoke the actual operation on the latest mutation in the chain.
|
|
if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
|
|
if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
}
|
|
}
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
mutation.id = &nodes[i].ID
|
|
if specs[i].ID.Value != nil && nodes[i].ID == 0 {
|
|
id := specs[i].ID.Value.(int64)
|
|
nodes[i].ID = uint64(id)
|
|
}
|
|
mutation.done = true
|
|
return nodes[i], nil
|
|
})
|
|
for i := len(builder.hooks) - 1; i >= 0; i-- {
|
|
mut = builder.hooks[i](mut)
|
|
}
|
|
mutators[i] = mut
|
|
}(i, ctx)
|
|
}
|
|
if len(mutators) > 0 {
|
|
if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
|
|
return nil, err
|
|
}
|
|
}
|
|
return nodes, nil
|
|
}
|
|
|
|
// SaveX is like Save, but panics if an error occurs.
|
|
func (_c *UserLoginLogCreateBulk) SaveX(ctx context.Context) []*UserLoginLog {
|
|
v, err := _c.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return v
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (_c *UserLoginLogCreateBulk) Exec(ctx context.Context) error {
|
|
_, err := _c.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_c *UserLoginLogCreateBulk) ExecX(ctx context.Context) {
|
|
if err := _c.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|