factory

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Code generated by carrier, DO NOT EDIT.

Code generated by carrier, DO NOT EDIT.

Code generated by carrier, DO NOT EDIT.

Code generated by carrier, DO NOT EDIT.

Index

Constants

View Source
const (
	TypeDefault  = iota + 1 // default value
	TypeFactory             // subfactory
	TypeSequence            // sequence
	TypeLazy                // lazy function
	TypePost                // post generation
)

Variables

This section is empty.

Functions

func EntCarTrait

func EntCarTrait() *entCarTrait

func EntGroupTrait

func EntGroupTrait() *entGroupTrait

func EntUserTrait

func EntUserTrait() *entUserTrait

Types

type Counter

type Counter struct {
	// contains filtered or unexported fields
}

func (*Counter) Get

func (c *Counter) Get() int

type EntCarBuilder

type EntCarBuilder struct {
	// contains filtered or unexported fields
}

func (*EntCarBuilder) Client

func (b *EntCarBuilder) Client(c *ten.Client) *EntCarBuilder

func (*EntCarBuilder) Create

func (b *EntCarBuilder) Create(ctx context.Context) (*ten.Car, error)

Create return a new *ten.Car

func (*EntCarBuilder) CreateBatch

func (b *EntCarBuilder) CreateBatch(ctx context.Context, n int) ([]*ten.Car, error)

func (*EntCarBuilder) CreateBatchV

func (b *EntCarBuilder) CreateBatchV(ctx context.Context, n int) ([]ten.Car, error)

func (*EntCarBuilder) CreateV

func (b *EntCarBuilder) CreateV(ctx context.Context) (ten.Car, error)

CreateV return a new ten.Car

func (*EntCarBuilder) SetModel

func (b *EntCarBuilder) SetModel(i string) *EntCarBuilder

SetModel set the Model field

func (*EntCarBuilder) SetOwner

func (b *EntCarBuilder) SetOwner(i *ten.User) *EntCarBuilder

SetOwner set the Owner field

func (*EntCarBuilder) SetOwnerID

func (b *EntCarBuilder) SetOwnerID(i int) *EntCarBuilder

SetOwnerID set the OwnerID field

func (*EntCarBuilder) SetRegisteredAt

func (b *EntCarBuilder) SetRegisteredAt(i time.Time) *EntCarBuilder

SetRegisteredAt set the RegisteredAt field

type EntCarFactory

type EntCarFactory struct {
	// contains filtered or unexported fields
}

func (*EntCarFactory) Client

func (f *EntCarFactory) Client(c *ten.Client) *EntCarFactory

Client set ent client to EntCarFactory

func (*EntCarFactory) Create

func (f *EntCarFactory) Create(ctx context.Context) (*ten.Car, error)

Create return a new *ten.Car

func (*EntCarFactory) CreateBatch

func (f *EntCarFactory) CreateBatch(ctx context.Context, n int) ([]*ten.Car, error)

CreateBatch return a []*ten.Car slice

func (*EntCarFactory) CreateBatchV

func (f *EntCarFactory) CreateBatchV(ctx context.Context, n int) ([]ten.Car, error)

CreateBatchV return a []ten.Car slice

func (*EntCarFactory) CreateV

func (f *EntCarFactory) CreateV(ctx context.Context) (ten.Car, error)

CreateV return a new ten.Car

func (*EntCarFactory) SetModel

func (f *EntCarFactory) SetModel(i string) *EntCarBuilder

SetModel set the Model field

func (*EntCarFactory) SetOwner

func (f *EntCarFactory) SetOwner(i *ten.User) *EntCarBuilder

SetOwner set the Owner field

func (*EntCarFactory) SetOwnerID

func (f *EntCarFactory) SetOwnerID(i int) *EntCarBuilder

SetOwnerID set the OwnerID field

func (*EntCarFactory) SetRegisteredAt

func (f *EntCarFactory) SetRegisteredAt(i time.Time) *EntCarBuilder

SetRegisteredAt set the RegisteredAt field

type EntCarMetaFactory

type EntCarMetaFactory struct {
	// contains filtered or unexported fields
}

func (*EntCarMetaFactory) Build

func (f *EntCarMetaFactory) Build() *EntCarFactory

Build create a EntCarFactory from EntCarMetaFactory

func (*EntCarMetaFactory) SetAfterCreateFunc

func (f *EntCarMetaFactory) SetAfterCreateFunc(fn func(ctx context.Context, i *ten.Car) error) *EntCarMetaFactory

SetAfterCreateFunc register a function to be called after struct create

func (*EntCarMetaFactory) SetBeforeCreateFunc

func (f *EntCarMetaFactory) SetBeforeCreateFunc(fn func(ctx context.Context, i *EntCarMutator) error) *EntCarMetaFactory

SetBeforeCreateFunc register a function to be called before struct create

func (*EntCarMetaFactory) SetModelDefault

func (f *EntCarMetaFactory) SetModelDefault(v string) *EntCarMetaFactory

SetModelDefault assign a default value to Model field

func (*EntCarMetaFactory) SetModelFactory

func (f *EntCarMetaFactory) SetModelFactory(fn func(ctx context.Context) (string, error)) *EntCarMetaFactory

SetModelFactory register a factory function and assign return value to Model, you can also use related factory's Create/CreateV as input function here

func (*EntCarMetaFactory) SetModelLazy

func (f *EntCarMetaFactory) SetModelLazy(fn func(ctx context.Context, i *EntCarMutator) (string, error)) *EntCarMetaFactory

SetModelLazy register a function which accept the build struct and set return value to Model field

func (*EntCarMetaFactory) SetModelSequence

func (f *EntCarMetaFactory) SetModelSequence(fn func(ctx context.Context, i int) (string, error)) *EntCarMetaFactory

SetModelSequence register a function which accept a sequence counter and set return value to Model field

func (*EntCarMetaFactory) SetOwnerDefault

func (f *EntCarMetaFactory) SetOwnerDefault(v *ten.User) *EntCarMetaFactory

SetOwnerDefault assign a default value to Owner field

func (*EntCarMetaFactory) SetOwnerFactory

func (f *EntCarMetaFactory) SetOwnerFactory(fn func(ctx context.Context) (*ten.User, error)) *EntCarMetaFactory

SetOwnerFactory register a factory function and assign return value to Owner, you can also use related factory's Create/CreateV as input function here

func (*EntCarMetaFactory) SetOwnerIDDefault

func (f *EntCarMetaFactory) SetOwnerIDDefault(v int) *EntCarMetaFactory

SetOwnerIDDefault assign a default value to OwnerID field

func (*EntCarMetaFactory) SetOwnerIDFactory

func (f *EntCarMetaFactory) SetOwnerIDFactory(fn func(ctx context.Context) (int, error)) *EntCarMetaFactory

SetOwnerIDFactory register a factory function and assign return value to OwnerID, you can also use related factory's Create/CreateV as input function here

func (*EntCarMetaFactory) SetOwnerIDLazy

func (f *EntCarMetaFactory) SetOwnerIDLazy(fn func(ctx context.Context, i *EntCarMutator) (int, error)) *EntCarMetaFactory

SetOwnerIDLazy register a function which accept the build struct and set return value to OwnerID field

func (*EntCarMetaFactory) SetOwnerIDSequence

func (f *EntCarMetaFactory) SetOwnerIDSequence(fn func(ctx context.Context, i int) (int, error)) *EntCarMetaFactory

SetOwnerIDSequence register a function which accept a sequence counter and set return value to OwnerID field

func (*EntCarMetaFactory) SetOwnerLazy

func (f *EntCarMetaFactory) SetOwnerLazy(fn func(ctx context.Context, i *EntCarMutator) (*ten.User, error)) *EntCarMetaFactory

SetOwnerLazy register a function which accept the build struct and set return value to Owner field

func (*EntCarMetaFactory) SetOwnerSequence

func (f *EntCarMetaFactory) SetOwnerSequence(fn func(ctx context.Context, i int) (*ten.User, error)) *EntCarMetaFactory

SetOwnerSequence register a function which accept a sequence counter and set return value to Owner field

func (*EntCarMetaFactory) SetRegisteredAtDefault

func (f *EntCarMetaFactory) SetRegisteredAtDefault(v time.Time) *EntCarMetaFactory

SetRegisteredAtDefault assign a default value to RegisteredAt field

func (*EntCarMetaFactory) SetRegisteredAtFactory

func (f *EntCarMetaFactory) SetRegisteredAtFactory(fn func(ctx context.Context) (time.Time, error)) *EntCarMetaFactory

SetRegisteredAtFactory register a factory function and assign return value to RegisteredAt, you can also use related factory's Create/CreateV as input function here

func (*EntCarMetaFactory) SetRegisteredAtLazy

func (f *EntCarMetaFactory) SetRegisteredAtLazy(fn func(ctx context.Context, i *EntCarMutator) (time.Time, error)) *EntCarMetaFactory

SetRegisteredAtLazy register a function which accept the build struct and set return value to RegisteredAt field

func (*EntCarMetaFactory) SetRegisteredAtSequence

func (f *EntCarMetaFactory) SetRegisteredAtSequence(fn func(ctx context.Context, i int) (time.Time, error)) *EntCarMetaFactory

SetRegisteredAtSequence register a function which accept a sequence counter and set return value to RegisteredAt field

type EntCarMutator

type EntCarMutator struct {
	Model string

	Owner *ten.User

	OwnerID int

	RegisteredAt time.Time
	// contains filtered or unexported fields
}

func (*EntCarMutator) EntCreator

func (m *EntCarMutator) EntCreator() *ten.CarCreate

type EntGroupBuilder

type EntGroupBuilder struct {
	// contains filtered or unexported fields
}

func (*EntGroupBuilder) Client

func (b *EntGroupBuilder) Client(c *ten.Client) *EntGroupBuilder

func (*EntGroupBuilder) Create

func (b *EntGroupBuilder) Create(ctx context.Context) (*ten.Group, error)

Create return a new *ten.Group

func (*EntGroupBuilder) CreateBatch

func (b *EntGroupBuilder) CreateBatch(ctx context.Context, n int) ([]*ten.Group, error)

func (*EntGroupBuilder) CreateBatchV

func (b *EntGroupBuilder) CreateBatchV(ctx context.Context, n int) ([]ten.Group, error)

func (*EntGroupBuilder) CreateV

func (b *EntGroupBuilder) CreateV(ctx context.Context) (ten.Group, error)

CreateV return a new ten.Group

func (*EntGroupBuilder) SetName

func (b *EntGroupBuilder) SetName(i string) *EntGroupBuilder

SetName set the Name field

func (*EntGroupBuilder) WithNouserTrait

func (b *EntGroupBuilder) WithNouserTrait() *EntGroupBuilder

WithNouserTrait() enable the Nouser trait

type EntGroupFactory

type EntGroupFactory struct {
	// contains filtered or unexported fields
}

func (*EntGroupFactory) Client

func (f *EntGroupFactory) Client(c *ten.Client) *EntGroupFactory

Client set ent client to EntGroupFactory

func (*EntGroupFactory) Create

func (f *EntGroupFactory) Create(ctx context.Context) (*ten.Group, error)

Create return a new *ten.Group

func (*EntGroupFactory) CreateBatch

func (f *EntGroupFactory) CreateBatch(ctx context.Context, n int) ([]*ten.Group, error)

CreateBatch return a []*ten.Group slice

func (*EntGroupFactory) CreateBatchV

func (f *EntGroupFactory) CreateBatchV(ctx context.Context, n int) ([]ten.Group, error)

CreateBatchV return a []ten.Group slice

func (*EntGroupFactory) CreateV

func (f *EntGroupFactory) CreateV(ctx context.Context) (ten.Group, error)

CreateV return a new ten.Group

func (*EntGroupFactory) SetName

func (f *EntGroupFactory) SetName(i string) *EntGroupBuilder

SetName set the Name field

func (*EntGroupFactory) WithNouserTrait

func (f *EntGroupFactory) WithNouserTrait() *EntGroupBuilder

WithNouserTrait() enable the Nouser trait

type EntGroupMetaFactory

type EntGroupMetaFactory struct {
	// contains filtered or unexported fields
}

func (*EntGroupMetaFactory) Build

Build create a EntGroupFactory from EntGroupMetaFactory

func (*EntGroupMetaFactory) SetAfterCreateFunc

func (f *EntGroupMetaFactory) SetAfterCreateFunc(fn func(ctx context.Context, i *ten.Group) error) *EntGroupMetaFactory

SetAfterCreateFunc register a function to be called after struct create

func (*EntGroupMetaFactory) SetBeforeCreateFunc

func (f *EntGroupMetaFactory) SetBeforeCreateFunc(fn func(ctx context.Context, i *EntGroupMutator) error) *EntGroupMetaFactory

SetBeforeCreateFunc register a function to be called before struct create

func (*EntGroupMetaFactory) SetNameDefault

func (f *EntGroupMetaFactory) SetNameDefault(v string) *EntGroupMetaFactory

SetNameDefault assign a default value to Name field

func (*EntGroupMetaFactory) SetNameFactory

func (f *EntGroupMetaFactory) SetNameFactory(fn func(ctx context.Context) (string, error)) *EntGroupMetaFactory

SetNameFactory register a factory function and assign return value to Name, you can also use related factory's Create/CreateV as input function here

func (*EntGroupMetaFactory) SetNameLazy

func (f *EntGroupMetaFactory) SetNameLazy(fn func(ctx context.Context, i *EntGroupMutator) (string, error)) *EntGroupMetaFactory

SetNameLazy register a function which accept the build struct and set return value to Name field

func (*EntGroupMetaFactory) SetNameSequence

func (f *EntGroupMetaFactory) SetNameSequence(fn func(ctx context.Context, i int) (string, error)) *EntGroupMetaFactory

SetNameSequence register a function which accept a sequence counter and set return value to Name field

func (*EntGroupMetaFactory) SetNouserTrait

func (f *EntGroupMetaFactory) SetNouserTrait(t *entGroupTrait) *EntGroupMetaFactory

SetNouserTrait accept a entGroupTrait, will override builder using Trait's methods if enable

type EntGroupMutator

type EntGroupMutator struct {
	Name string
	// contains filtered or unexported fields
}

func (*EntGroupMutator) EntCreator

func (m *EntGroupMutator) EntCreator() *ten.GroupCreate

type EntUserBuilder

type EntUserBuilder struct {
	// contains filtered or unexported fields
}

func (*EntUserBuilder) Client

func (b *EntUserBuilder) Client(c *ten.Client) *EntUserBuilder

func (*EntUserBuilder) Create

func (b *EntUserBuilder) Create(ctx context.Context) (*ten.User, error)

Create return a new *ten.User

func (*EntUserBuilder) CreateBatch

func (b *EntUserBuilder) CreateBatch(ctx context.Context, n int) ([]*ten.User, error)

func (*EntUserBuilder) CreateBatchV

func (b *EntUserBuilder) CreateBatchV(ctx context.Context, n int) ([]ten.User, error)

func (*EntUserBuilder) CreateV

func (b *EntUserBuilder) CreateV(ctx context.Context) (ten.User, error)

CreateV return a new ten.User

func (*EntUserBuilder) SetAge

func (b *EntUserBuilder) SetAge(i int) *EntUserBuilder

SetAge set the Age field

func (*EntUserBuilder) SetEmail

func (b *EntUserBuilder) SetEmail(i string) *EntUserBuilder

SetEmail set the Email field

func (*EntUserBuilder) SetGroupsPost

func (b *EntUserBuilder) SetGroupsPost(i int) *EntUserBuilder

SetGroupsPost call the post function with int input

func (*EntUserBuilder) SetName

func (b *EntUserBuilder) SetName(i string) *EntUserBuilder

SetName set the Name field

type EntUserFactory

type EntUserFactory struct {
	// contains filtered or unexported fields
}

func (*EntUserFactory) Client

func (f *EntUserFactory) Client(c *ten.Client) *EntUserFactory

Client set ent client to EntUserFactory

func (*EntUserFactory) Create

func (f *EntUserFactory) Create(ctx context.Context) (*ten.User, error)

Create return a new *ten.User

func (*EntUserFactory) CreateBatch

func (f *EntUserFactory) CreateBatch(ctx context.Context, n int) ([]*ten.User, error)

CreateBatch return a []*ten.User slice

func (*EntUserFactory) CreateBatchV

func (f *EntUserFactory) CreateBatchV(ctx context.Context, n int) ([]ten.User, error)

CreateBatchV return a []ten.User slice

func (*EntUserFactory) CreateV

func (f *EntUserFactory) CreateV(ctx context.Context) (ten.User, error)

CreateV return a new ten.User

func (*EntUserFactory) SetAge

func (f *EntUserFactory) SetAge(i int) *EntUserBuilder

SetAge set the Age field

func (*EntUserFactory) SetEmail

func (f *EntUserFactory) SetEmail(i string) *EntUserBuilder

SetEmail set the Email field

func (*EntUserFactory) SetGroupsPost

func (f *EntUserFactory) SetGroupsPost(i int) *EntUserBuilder

SetGroupsPost call the post function with int input

func (*EntUserFactory) SetName

func (f *EntUserFactory) SetName(i string) *EntUserBuilder

SetName set the Name field

type EntUserMetaFactory

type EntUserMetaFactory struct {
	// contains filtered or unexported fields
}

func (*EntUserMetaFactory) Build

func (f *EntUserMetaFactory) Build() *EntUserFactory

Build create a EntUserFactory from EntUserMetaFactory

func (*EntUserMetaFactory) SetAfterCreateFunc

func (f *EntUserMetaFactory) SetAfterCreateFunc(fn func(ctx context.Context, i *ten.User) error) *EntUserMetaFactory

SetAfterCreateFunc register a function to be called after struct create

func (*EntUserMetaFactory) SetAgeDefault

func (f *EntUserMetaFactory) SetAgeDefault(v int) *EntUserMetaFactory

SetAgeDefault assign a default value to Age field

func (*EntUserMetaFactory) SetAgeFactory

func (f *EntUserMetaFactory) SetAgeFactory(fn func(ctx context.Context) (int, error)) *EntUserMetaFactory

SetAgeFactory register a factory function and assign return value to Age, you can also use related factory's Create/CreateV as input function here

func (*EntUserMetaFactory) SetAgeLazy

func (f *EntUserMetaFactory) SetAgeLazy(fn func(ctx context.Context, i *EntUserMutator) (int, error)) *EntUserMetaFactory

SetAgeLazy register a function which accept the build struct and set return value to Age field

func (*EntUserMetaFactory) SetAgeSequence

func (f *EntUserMetaFactory) SetAgeSequence(fn func(ctx context.Context, i int) (int, error)) *EntUserMetaFactory

SetAgeSequence register a function which accept a sequence counter and set return value to Age field

func (*EntUserMetaFactory) SetBeforeCreateFunc

func (f *EntUserMetaFactory) SetBeforeCreateFunc(fn func(ctx context.Context, i *EntUserMutator) error) *EntUserMetaFactory

SetBeforeCreateFunc register a function to be called before struct create

func (*EntUserMetaFactory) SetEmailDefault

func (f *EntUserMetaFactory) SetEmailDefault(v string) *EntUserMetaFactory

SetEmailDefault assign a default value to Email field

func (*EntUserMetaFactory) SetEmailFactory

func (f *EntUserMetaFactory) SetEmailFactory(fn func(ctx context.Context) (string, error)) *EntUserMetaFactory

SetEmailFactory register a factory function and assign return value to Email, you can also use related factory's Create/CreateV as input function here

func (*EntUserMetaFactory) SetEmailLazy

func (f *EntUserMetaFactory) SetEmailLazy(fn func(ctx context.Context, i *EntUserMutator) (string, error)) *EntUserMetaFactory

SetEmailLazy register a function which accept the build struct and set return value to Email field

func (*EntUserMetaFactory) SetEmailSequence

func (f *EntUserMetaFactory) SetEmailSequence(fn func(ctx context.Context, i int) (string, error)) *EntUserMetaFactory

SetEmailSequence register a function which accept a sequence counter and set return value to Email field

func (*EntUserMetaFactory) SetGroupsPostFunc

func (f *EntUserMetaFactory) SetGroupsPostFunc(fn func(ctx context.Context, set bool, obj *ten.User, i int) error) *EntUserMetaFactory

SetGroupsPostFunc register a post function which will be called in factory SetGroupsPost method

func (*EntUserMetaFactory) SetNameDefault

func (f *EntUserMetaFactory) SetNameDefault(v string) *EntUserMetaFactory

SetNameDefault assign a default value to Name field

func (*EntUserMetaFactory) SetNameFactory

func (f *EntUserMetaFactory) SetNameFactory(fn func(ctx context.Context) (string, error)) *EntUserMetaFactory

SetNameFactory register a factory function and assign return value to Name, you can also use related factory's Create/CreateV as input function here

func (*EntUserMetaFactory) SetNameLazy

func (f *EntUserMetaFactory) SetNameLazy(fn func(ctx context.Context, i *EntUserMutator) (string, error)) *EntUserMetaFactory

SetNameLazy register a function which accept the build struct and set return value to Name field

func (*EntUserMetaFactory) SetNameSequence

func (f *EntUserMetaFactory) SetNameSequence(fn func(ctx context.Context, i int) (string, error)) *EntUserMetaFactory

SetNameSequence register a function which accept a sequence counter and set return value to Name field

type EntUserMutator

type EntUserMutator struct {
	Age int

	Email string

	Name string
	// contains filtered or unexported fields
}

func (*EntUserMutator) EntCreator

func (m *EntUserMutator) EntCreator() *ten.UserCreate

Jump to

Keyboard shortcuts

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