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: 3 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.

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 CategoryTrait

func CategoryTrait() *categoryTrait

func IngredientTrait

func IngredientTrait() *ingredientTrait

func RecipeIngredientTrait

func RecipeIngredientTrait() *recipeIngredientTrait

func RecipeStepTrait

func RecipeStepTrait() *recipeStepTrait

func RecipeTrait

func RecipeTrait() *recipeTrait

func UserTrait

func UserTrait() *userTrait

Types

type CategoryBuilder

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

func (*CategoryBuilder) Create

func (b *CategoryBuilder) Create(ctx context.Context) (*model.Category, error)

Create return a new *model.Category

func (*CategoryBuilder) CreateBatch

func (b *CategoryBuilder) CreateBatch(ctx context.Context, n int) ([]*model.Category, error)

func (*CategoryBuilder) CreateBatchV

func (b *CategoryBuilder) CreateBatchV(ctx context.Context, n int) ([]model.Category, error)

func (*CategoryBuilder) CreateV

func (b *CategoryBuilder) CreateV(ctx context.Context) (model.Category, error)

CreateV return a new model.Category

func (*CategoryBuilder) SetName

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

SetName set the Name field

type CategoryFactory

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

func (*CategoryFactory) Create

func (f *CategoryFactory) Create(ctx context.Context) (*model.Category, error)

Create return a new *model.Category

func (*CategoryFactory) CreateBatch

func (f *CategoryFactory) CreateBatch(ctx context.Context, n int) ([]*model.Category, error)

CreateBatch return a []*model.Category slice

func (*CategoryFactory) CreateBatchV

func (f *CategoryFactory) CreateBatchV(ctx context.Context, n int) ([]model.Category, error)

CreateBatchV return a []model.Category slice

func (*CategoryFactory) CreateV

func (f *CategoryFactory) CreateV(ctx context.Context) (model.Category, error)

CreateV return a new model.Category

func (*CategoryFactory) SetName

func (f *CategoryFactory) SetName(i string) *CategoryBuilder

SetName set the Name field

type CategoryMetaFactory

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

func (*CategoryMetaFactory) Build

Build create a CategoryFactory from CategoryMetaFactory

func (*CategoryMetaFactory) SetAfterCreateFunc

func (f *CategoryMetaFactory) SetAfterCreateFunc(fn func(ctx context.Context, i *model.Category) error) *CategoryMetaFactory

SetAfterCreateFunc register a function to be called after struct create

func (*CategoryMetaFactory) SetBeforeCreateFunc added in v0.1.1

func (f *CategoryMetaFactory) SetBeforeCreateFunc(fn func(ctx context.Context, i *model.Category) error) *CategoryMetaFactory

SetBeforeCreateFunc register a function to be called before struct create

func (*CategoryMetaFactory) SetNameDefault

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

SetNameDefault assign a default value to Name field

func (*CategoryMetaFactory) SetNameFactory

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

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 (*CategoryMetaFactory) SetNameLazy

func (f *CategoryMetaFactory) SetNameLazy(fn func(ctx context.Context, i *model.Category) (string, error)) *CategoryMetaFactory

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

func (*CategoryMetaFactory) SetNameSequence

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

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

type Counter

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

func (*Counter) Get

func (c *Counter) Get() int

type IngredientBuilder

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

func (*IngredientBuilder) Create

Create return a new *model.Ingredient

func (*IngredientBuilder) CreateBatch

func (b *IngredientBuilder) CreateBatch(ctx context.Context, n int) ([]*model.Ingredient, error)

func (*IngredientBuilder) CreateBatchV

func (b *IngredientBuilder) CreateBatchV(ctx context.Context, n int) ([]model.Ingredient, error)

func (*IngredientBuilder) CreateV

CreateV return a new model.Ingredient

func (*IngredientBuilder) SetName

SetName set the Name field

func (*IngredientBuilder) SetTags

SetTags set the Tags field

type IngredientFactory

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

func (*IngredientFactory) Create

Create return a new *model.Ingredient

func (*IngredientFactory) CreateBatch

func (f *IngredientFactory) CreateBatch(ctx context.Context, n int) ([]*model.Ingredient, error)

CreateBatch return a []*model.Ingredient slice

func (*IngredientFactory) CreateBatchV

func (f *IngredientFactory) CreateBatchV(ctx context.Context, n int) ([]model.Ingredient, error)

CreateBatchV return a []model.Ingredient slice

func (*IngredientFactory) CreateV

CreateV return a new model.Ingredient

func (*IngredientFactory) SetName

SetName set the Name field

func (*IngredientFactory) SetTags

SetTags set the Tags field

type IngredientMetaFactory

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

func (*IngredientMetaFactory) Build

Build create a IngredientFactory from IngredientMetaFactory

func (*IngredientMetaFactory) SetAfterCreateFunc

func (f *IngredientMetaFactory) SetAfterCreateFunc(fn func(ctx context.Context, i *model.Ingredient) error) *IngredientMetaFactory

SetAfterCreateFunc register a function to be called after struct create

func (*IngredientMetaFactory) SetBeforeCreateFunc added in v0.1.1

func (f *IngredientMetaFactory) SetBeforeCreateFunc(fn func(ctx context.Context, i *model.Ingredient) error) *IngredientMetaFactory

SetBeforeCreateFunc register a function to be called before struct create

func (*IngredientMetaFactory) SetNameDefault

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

SetNameDefault assign a default value to Name field

func (*IngredientMetaFactory) SetNameFactory

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

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 (*IngredientMetaFactory) SetNameLazy

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

func (*IngredientMetaFactory) SetNameSequence

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

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

func (*IngredientMetaFactory) SetTagsDefault

func (f *IngredientMetaFactory) SetTagsDefault(v []*model.Category) *IngredientMetaFactory

SetTagsDefault assign a default value to Tags field

func (*IngredientMetaFactory) SetTagsFactory

func (f *IngredientMetaFactory) SetTagsFactory(fn func(ctx context.Context) ([]*model.Category, error)) *IngredientMetaFactory

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

func (*IngredientMetaFactory) SetTagsLazy

SetTagsLazy register a function which accept the build struct and set return value to Tags field

func (*IngredientMetaFactory) SetTagsSequence

func (f *IngredientMetaFactory) SetTagsSequence(fn func(ctx context.Context, i int) ([]*model.Category, error)) *IngredientMetaFactory

SetTagsSequence register a function which accept a sequence counter and set return value to Tags field

type RecipeBuilder

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

func (*RecipeBuilder) Create

func (b *RecipeBuilder) Create(ctx context.Context) (*model.Recipe, error)

Create return a new *model.Recipe

func (*RecipeBuilder) CreateBatch

func (b *RecipeBuilder) CreateBatch(ctx context.Context, n int) ([]*model.Recipe, error)

func (*RecipeBuilder) CreateBatchV

func (b *RecipeBuilder) CreateBatchV(ctx context.Context, n int) ([]model.Recipe, error)

func (*RecipeBuilder) CreateV

func (b *RecipeBuilder) CreateV(ctx context.Context) (model.Recipe, error)

CreateV return a new model.Recipe

func (*RecipeBuilder) SetAuthorName

func (b *RecipeBuilder) SetAuthorName(i string) *RecipeBuilder

SetAuthorName set the AuthorName field

func (*RecipeBuilder) SetIngredients

func (b *RecipeBuilder) SetIngredients(i []*model.RecipeIngredient) *RecipeBuilder

SetIngredients set the Ingredients field

func (*RecipeBuilder) SetIngredientsCountPost

func (b *RecipeBuilder) SetIngredientsCountPost(i int) *RecipeBuilder

SetIngredientsCountPost call the post function with int input

func (*RecipeBuilder) SetName

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

SetName set the Name field

func (*RecipeBuilder) SetRelated

func (b *RecipeBuilder) SetRelated(i []*model.Recipe) *RecipeBuilder

SetRelated set the Related field

func (*RecipeBuilder) SetServings

func (b *RecipeBuilder) SetServings(i int) *RecipeBuilder

SetServings set the Servings field

func (*RecipeBuilder) SetSteps

func (b *RecipeBuilder) SetSteps(i []*model.RecipeStep) *RecipeBuilder

SetSteps set the Steps field

func (*RecipeBuilder) SetStepsCountPost

func (b *RecipeBuilder) SetStepsCountPost(i int) *RecipeBuilder

SetStepsCountPost call the post function with int input

func (*RecipeBuilder) SetTags

func (b *RecipeBuilder) SetTags(i []*model.Category) *RecipeBuilder

SetTags set the Tags field

func (*RecipeBuilder) WithKetoTrait

func (b *RecipeBuilder) WithKetoTrait() *RecipeBuilder

WithKetoTrait() enable the Keto trait

func (*RecipeBuilder) WithVeganTrait

func (b *RecipeBuilder) WithVeganTrait() *RecipeBuilder

WithVeganTrait() enable the Vegan trait

type RecipeFactory

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

func (*RecipeFactory) Create

func (f *RecipeFactory) Create(ctx context.Context) (*model.Recipe, error)

Create return a new *model.Recipe

func (*RecipeFactory) CreateBatch

func (f *RecipeFactory) CreateBatch(ctx context.Context, n int) ([]*model.Recipe, error)

CreateBatch return a []*model.Recipe slice

func (*RecipeFactory) CreateBatchV

func (f *RecipeFactory) CreateBatchV(ctx context.Context, n int) ([]model.Recipe, error)

CreateBatchV return a []model.Recipe slice

func (*RecipeFactory) CreateV

func (f *RecipeFactory) CreateV(ctx context.Context) (model.Recipe, error)

CreateV return a new model.Recipe

func (*RecipeFactory) SetAuthorName

func (f *RecipeFactory) SetAuthorName(i string) *RecipeBuilder

SetAuthorName set the AuthorName field

func (*RecipeFactory) SetIngredients

func (f *RecipeFactory) SetIngredients(i []*model.RecipeIngredient) *RecipeBuilder

SetIngredients set the Ingredients field

func (*RecipeFactory) SetIngredientsCountPost

func (f *RecipeFactory) SetIngredientsCountPost(i int) *RecipeBuilder

SetIngredientsCountPost call the post function with int input

func (*RecipeFactory) SetName

func (f *RecipeFactory) SetName(i string) *RecipeBuilder

SetName set the Name field

func (*RecipeFactory) SetRelated

func (f *RecipeFactory) SetRelated(i []*model.Recipe) *RecipeBuilder

SetRelated set the Related field

func (*RecipeFactory) SetServings

func (f *RecipeFactory) SetServings(i int) *RecipeBuilder

SetServings set the Servings field

func (*RecipeFactory) SetSteps

func (f *RecipeFactory) SetSteps(i []*model.RecipeStep) *RecipeBuilder

SetSteps set the Steps field

func (*RecipeFactory) SetStepsCountPost

func (f *RecipeFactory) SetStepsCountPost(i int) *RecipeBuilder

SetStepsCountPost call the post function with int input

func (*RecipeFactory) SetTags

func (f *RecipeFactory) SetTags(i []*model.Category) *RecipeBuilder

SetTags set the Tags field

func (*RecipeFactory) WithKetoTrait

func (f *RecipeFactory) WithKetoTrait() *RecipeBuilder

WithKetoTrait() enable the Keto trait

func (*RecipeFactory) WithVeganTrait

func (f *RecipeFactory) WithVeganTrait() *RecipeBuilder

WithVeganTrait() enable the Vegan trait

type RecipeIngredientBuilder

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

func (*RecipeIngredientBuilder) Create

Create return a new *model.RecipeIngredient

func (*RecipeIngredientBuilder) CreateBatch

func (b *RecipeIngredientBuilder) CreateBatch(ctx context.Context, n int) ([]*model.RecipeIngredient, error)

func (*RecipeIngredientBuilder) CreateBatchV

func (b *RecipeIngredientBuilder) CreateBatchV(ctx context.Context, n int) ([]model.RecipeIngredient, error)

func (*RecipeIngredientBuilder) CreateV

CreateV return a new model.RecipeIngredient

func (*RecipeIngredientBuilder) SetIngredient

SetIngredient set the Ingredient field

func (*RecipeIngredientBuilder) SetQuantity

SetQuantity set the Quantity field

func (*RecipeIngredientBuilder) SetUnit

SetUnit set the Unit field

type RecipeIngredientFactory

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

func (*RecipeIngredientFactory) Create

Create return a new *model.RecipeIngredient

func (*RecipeIngredientFactory) CreateBatch

func (f *RecipeIngredientFactory) CreateBatch(ctx context.Context, n int) ([]*model.RecipeIngredient, error)

CreateBatch return a []*model.RecipeIngredient slice

func (*RecipeIngredientFactory) CreateBatchV

func (f *RecipeIngredientFactory) CreateBatchV(ctx context.Context, n int) ([]model.RecipeIngredient, error)

CreateBatchV return a []model.RecipeIngredient slice

func (*RecipeIngredientFactory) CreateV

CreateV return a new model.RecipeIngredient

func (*RecipeIngredientFactory) SetIngredient

SetIngredient set the Ingredient field

func (*RecipeIngredientFactory) SetQuantity

SetQuantity set the Quantity field

func (*RecipeIngredientFactory) SetUnit

SetUnit set the Unit field

type RecipeIngredientMetaFactory

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

func (*RecipeIngredientMetaFactory) Build

Build create a RecipeIngredientFactory from RecipeIngredientMetaFactory

func (*RecipeIngredientMetaFactory) SetAfterCreateFunc

SetAfterCreateFunc register a function to be called after struct create

func (*RecipeIngredientMetaFactory) SetBeforeCreateFunc added in v0.1.1

SetBeforeCreateFunc register a function to be called before struct create

func (*RecipeIngredientMetaFactory) SetIngredientDefault

SetIngredientDefault assign a default value to Ingredient field

func (*RecipeIngredientMetaFactory) SetIngredientFactory

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

func (*RecipeIngredientMetaFactory) SetIngredientLazy

SetIngredientLazy register a function which accept the build struct and set return value to Ingredient field

func (*RecipeIngredientMetaFactory) SetIngredientSequence

func (f *RecipeIngredientMetaFactory) SetIngredientSequence(fn func(ctx context.Context, i int) (*model.Ingredient, error)) *RecipeIngredientMetaFactory

SetIngredientSequence register a function which accept a sequence counter and set return value to Ingredient field

func (*RecipeIngredientMetaFactory) SetQuantityDefault

SetQuantityDefault assign a default value to Quantity field

func (*RecipeIngredientMetaFactory) SetQuantityFactory

func (f *RecipeIngredientMetaFactory) SetQuantityFactory(fn func(ctx context.Context) (float32, error)) *RecipeIngredientMetaFactory

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

func (*RecipeIngredientMetaFactory) SetQuantityLazy

SetQuantityLazy register a function which accept the build struct and set return value to Quantity field

func (*RecipeIngredientMetaFactory) SetQuantitySequence

func (f *RecipeIngredientMetaFactory) SetQuantitySequence(fn func(ctx context.Context, i int) (float32, error)) *RecipeIngredientMetaFactory

SetQuantitySequence register a function which accept a sequence counter and set return value to Quantity field

func (*RecipeIngredientMetaFactory) SetUnitDefault

SetUnitDefault assign a default value to Unit field

func (*RecipeIngredientMetaFactory) SetUnitFactory

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

func (*RecipeIngredientMetaFactory) SetUnitLazy

SetUnitLazy register a function which accept the build struct and set return value to Unit field

func (*RecipeIngredientMetaFactory) SetUnitSequence

func (f *RecipeIngredientMetaFactory) SetUnitSequence(fn func(ctx context.Context, i int) (string, error)) *RecipeIngredientMetaFactory

SetUnitSequence register a function which accept a sequence counter and set return value to Unit field

type RecipeMetaFactory

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

func (*RecipeMetaFactory) Build

func (f *RecipeMetaFactory) Build() *RecipeFactory

Build create a RecipeFactory from RecipeMetaFactory

func (*RecipeMetaFactory) SetAfterCreateFunc

func (f *RecipeMetaFactory) SetAfterCreateFunc(fn func(ctx context.Context, i *model.Recipe) error) *RecipeMetaFactory

SetAfterCreateFunc register a function to be called after struct create

func (*RecipeMetaFactory) SetAuthorNameDefault

func (f *RecipeMetaFactory) SetAuthorNameDefault(v string) *RecipeMetaFactory

SetAuthorNameDefault assign a default value to AuthorName field

func (*RecipeMetaFactory) SetAuthorNameFactory

func (f *RecipeMetaFactory) SetAuthorNameFactory(fn func(ctx context.Context) (string, error)) *RecipeMetaFactory

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

func (*RecipeMetaFactory) SetAuthorNameLazy

func (f *RecipeMetaFactory) SetAuthorNameLazy(fn func(ctx context.Context, i *model.Recipe) (string, error)) *RecipeMetaFactory

SetAuthorNameLazy register a function which accept the build struct and set return value to AuthorName field

func (*RecipeMetaFactory) SetAuthorNameSequence

func (f *RecipeMetaFactory) SetAuthorNameSequence(fn func(ctx context.Context, i int) (string, error)) *RecipeMetaFactory

SetAuthorNameSequence register a function which accept a sequence counter and set return value to AuthorName field

func (*RecipeMetaFactory) SetBeforeCreateFunc added in v0.1.1

func (f *RecipeMetaFactory) SetBeforeCreateFunc(fn func(ctx context.Context, i *model.Recipe) error) *RecipeMetaFactory

SetBeforeCreateFunc register a function to be called before struct create

func (*RecipeMetaFactory) SetIngredientsCountPostFunc

func (f *RecipeMetaFactory) SetIngredientsCountPostFunc(fn func(ctx context.Context, set bool, obj *model.Recipe, i int) error) *RecipeMetaFactory

SetIngredientsCountPostFunc register a post function which will be called in factory SetIngredientsCountPost method

func (*RecipeMetaFactory) SetIngredientsDefault

func (f *RecipeMetaFactory) SetIngredientsDefault(v []*model.RecipeIngredient) *RecipeMetaFactory

SetIngredientsDefault assign a default value to Ingredients field

func (*RecipeMetaFactory) SetIngredientsFactory

func (f *RecipeMetaFactory) SetIngredientsFactory(fn func(ctx context.Context) ([]*model.RecipeIngredient, error)) *RecipeMetaFactory

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

func (*RecipeMetaFactory) SetIngredientsLazy

func (f *RecipeMetaFactory) SetIngredientsLazy(fn func(ctx context.Context, i *model.Recipe) ([]*model.RecipeIngredient, error)) *RecipeMetaFactory

SetIngredientsLazy register a function which accept the build struct and set return value to Ingredients field

func (*RecipeMetaFactory) SetIngredientsSequence

func (f *RecipeMetaFactory) SetIngredientsSequence(fn func(ctx context.Context, i int) ([]*model.RecipeIngredient, error)) *RecipeMetaFactory

SetIngredientsSequence register a function which accept a sequence counter and set return value to Ingredients field

func (*RecipeMetaFactory) SetKetoTrait

func (f *RecipeMetaFactory) SetKetoTrait(t *recipeTrait) *RecipeMetaFactory

SetKetoTrait accept a recipeTrait, will override builder using Trait's methods if enable

func (*RecipeMetaFactory) SetNameDefault

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

SetNameDefault assign a default value to Name field

func (*RecipeMetaFactory) SetNameFactory

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

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 (*RecipeMetaFactory) SetNameLazy

func (f *RecipeMetaFactory) SetNameLazy(fn func(ctx context.Context, i *model.Recipe) (string, error)) *RecipeMetaFactory

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

func (*RecipeMetaFactory) SetNameSequence

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

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

func (*RecipeMetaFactory) SetRelatedDefault

func (f *RecipeMetaFactory) SetRelatedDefault(v []*model.Recipe) *RecipeMetaFactory

SetRelatedDefault assign a default value to Related field

func (*RecipeMetaFactory) SetRelatedFactory

func (f *RecipeMetaFactory) SetRelatedFactory(fn func(ctx context.Context) ([]*model.Recipe, error)) *RecipeMetaFactory

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

func (*RecipeMetaFactory) SetRelatedLazy

func (f *RecipeMetaFactory) SetRelatedLazy(fn func(ctx context.Context, i *model.Recipe) ([]*model.Recipe, error)) *RecipeMetaFactory

SetRelatedLazy register a function which accept the build struct and set return value to Related field

func (*RecipeMetaFactory) SetRelatedSequence

func (f *RecipeMetaFactory) SetRelatedSequence(fn func(ctx context.Context, i int) ([]*model.Recipe, error)) *RecipeMetaFactory

SetRelatedSequence register a function which accept a sequence counter and set return value to Related field

func (*RecipeMetaFactory) SetServingsDefault

func (f *RecipeMetaFactory) SetServingsDefault(v int) *RecipeMetaFactory

SetServingsDefault assign a default value to Servings field

func (*RecipeMetaFactory) SetServingsFactory

func (f *RecipeMetaFactory) SetServingsFactory(fn func(ctx context.Context) (int, error)) *RecipeMetaFactory

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

func (*RecipeMetaFactory) SetServingsLazy

func (f *RecipeMetaFactory) SetServingsLazy(fn func(ctx context.Context, i *model.Recipe) (int, error)) *RecipeMetaFactory

SetServingsLazy register a function which accept the build struct and set return value to Servings field

func (*RecipeMetaFactory) SetServingsSequence

func (f *RecipeMetaFactory) SetServingsSequence(fn func(ctx context.Context, i int) (int, error)) *RecipeMetaFactory

SetServingsSequence register a function which accept a sequence counter and set return value to Servings field

func (*RecipeMetaFactory) SetStepsCountPostFunc

func (f *RecipeMetaFactory) SetStepsCountPostFunc(fn func(ctx context.Context, set bool, obj *model.Recipe, i int) error) *RecipeMetaFactory

SetStepsCountPostFunc register a post function which will be called in factory SetStepsCountPost method

func (*RecipeMetaFactory) SetStepsDefault

func (f *RecipeMetaFactory) SetStepsDefault(v []*model.RecipeStep) *RecipeMetaFactory

SetStepsDefault assign a default value to Steps field

func (*RecipeMetaFactory) SetStepsFactory

func (f *RecipeMetaFactory) SetStepsFactory(fn func(ctx context.Context) ([]*model.RecipeStep, error)) *RecipeMetaFactory

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

func (*RecipeMetaFactory) SetStepsLazy

func (f *RecipeMetaFactory) SetStepsLazy(fn func(ctx context.Context, i *model.Recipe) ([]*model.RecipeStep, error)) *RecipeMetaFactory

SetStepsLazy register a function which accept the build struct and set return value to Steps field

func (*RecipeMetaFactory) SetStepsSequence

func (f *RecipeMetaFactory) SetStepsSequence(fn func(ctx context.Context, i int) ([]*model.RecipeStep, error)) *RecipeMetaFactory

SetStepsSequence register a function which accept a sequence counter and set return value to Steps field

func (*RecipeMetaFactory) SetTagsDefault

func (f *RecipeMetaFactory) SetTagsDefault(v []*model.Category) *RecipeMetaFactory

SetTagsDefault assign a default value to Tags field

func (*RecipeMetaFactory) SetTagsFactory

func (f *RecipeMetaFactory) SetTagsFactory(fn func(ctx context.Context) ([]*model.Category, error)) *RecipeMetaFactory

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

func (*RecipeMetaFactory) SetTagsLazy

func (f *RecipeMetaFactory) SetTagsLazy(fn func(ctx context.Context, i *model.Recipe) ([]*model.Category, error)) *RecipeMetaFactory

SetTagsLazy register a function which accept the build struct and set return value to Tags field

func (*RecipeMetaFactory) SetTagsSequence

func (f *RecipeMetaFactory) SetTagsSequence(fn func(ctx context.Context, i int) ([]*model.Category, error)) *RecipeMetaFactory

SetTagsSequence register a function which accept a sequence counter and set return value to Tags field

func (*RecipeMetaFactory) SetVeganTrait

func (f *RecipeMetaFactory) SetVeganTrait(t *recipeTrait) *RecipeMetaFactory

SetVeganTrait accept a recipeTrait, will override builder using Trait's methods if enable

type RecipeStepBuilder

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

func (*RecipeStepBuilder) Create

Create return a new *model.RecipeStep

func (*RecipeStepBuilder) CreateBatch

func (b *RecipeStepBuilder) CreateBatch(ctx context.Context, n int) ([]*model.RecipeStep, error)

func (*RecipeStepBuilder) CreateBatchV

func (b *RecipeStepBuilder) CreateBatchV(ctx context.Context, n int) ([]model.RecipeStep, error)

func (*RecipeStepBuilder) CreateV

CreateV return a new model.RecipeStep

func (*RecipeStepBuilder) SetText

SetText set the Text field

type RecipeStepFactory

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

func (*RecipeStepFactory) Create

Create return a new *model.RecipeStep

func (*RecipeStepFactory) CreateBatch

func (f *RecipeStepFactory) CreateBatch(ctx context.Context, n int) ([]*model.RecipeStep, error)

CreateBatch return a []*model.RecipeStep slice

func (*RecipeStepFactory) CreateBatchV

func (f *RecipeStepFactory) CreateBatchV(ctx context.Context, n int) ([]model.RecipeStep, error)

CreateBatchV return a []model.RecipeStep slice

func (*RecipeStepFactory) CreateV

CreateV return a new model.RecipeStep

func (*RecipeStepFactory) SetText

SetText set the Text field

type RecipeStepMetaFactory

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

func (*RecipeStepMetaFactory) Build

Build create a RecipeStepFactory from RecipeStepMetaFactory

func (*RecipeStepMetaFactory) SetAfterCreateFunc

func (f *RecipeStepMetaFactory) SetAfterCreateFunc(fn func(ctx context.Context, i *model.RecipeStep) error) *RecipeStepMetaFactory

SetAfterCreateFunc register a function to be called after struct create

func (*RecipeStepMetaFactory) SetBeforeCreateFunc added in v0.1.1

func (f *RecipeStepMetaFactory) SetBeforeCreateFunc(fn func(ctx context.Context, i *model.RecipeStep) error) *RecipeStepMetaFactory

SetBeforeCreateFunc register a function to be called before struct create

func (*RecipeStepMetaFactory) SetTextDefault

func (f *RecipeStepMetaFactory) SetTextDefault(v string) *RecipeStepMetaFactory

SetTextDefault assign a default value to Text field

func (*RecipeStepMetaFactory) SetTextFactory

func (f *RecipeStepMetaFactory) SetTextFactory(fn func(ctx context.Context) (string, error)) *RecipeStepMetaFactory

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

func (*RecipeStepMetaFactory) SetTextLazy

SetTextLazy register a function which accept the build struct and set return value to Text field

func (*RecipeStepMetaFactory) SetTextSequence

func (f *RecipeStepMetaFactory) SetTextSequence(fn func(ctx context.Context, i int) (string, error)) *RecipeStepMetaFactory

SetTextSequence register a function which accept a sequence counter and set return value to Text field

type UserBuilder

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

func (*UserBuilder) Create

func (b *UserBuilder) Create(ctx context.Context) (*model.User, error)

Create return a new *model.User

func (*UserBuilder) CreateBatch

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

func (*UserBuilder) CreateBatchV

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

func (*UserBuilder) CreateV

func (b *UserBuilder) CreateV(ctx context.Context) (model.User, error)

CreateV return a new model.User

func (*UserBuilder) SetName

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

SetName set the Name field

func (*UserBuilder) SetRecipes

func (b *UserBuilder) SetRecipes(i []*model.Recipe) *UserBuilder

SetRecipes set the Recipes field

func (*UserBuilder) SetRecipesPost

func (b *UserBuilder) SetRecipesPost(i int) *UserBuilder

SetRecipesPost call the post function with int input

func (*UserBuilder) SetTags

func (b *UserBuilder) SetTags(i []*model.Category) *UserBuilder

SetTags set the Tags field

type UserFactory

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

func (*UserFactory) Create

func (f *UserFactory) Create(ctx context.Context) (*model.User, error)

Create return a new *model.User

func (*UserFactory) CreateBatch

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

CreateBatch return a []*model.User slice

func (*UserFactory) CreateBatchV

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

CreateBatchV return a []model.User slice

func (*UserFactory) CreateV

func (f *UserFactory) CreateV(ctx context.Context) (model.User, error)

CreateV return a new model.User

func (*UserFactory) SetName

func (f *UserFactory) SetName(i string) *UserBuilder

SetName set the Name field

func (*UserFactory) SetRecipes

func (f *UserFactory) SetRecipes(i []*model.Recipe) *UserBuilder

SetRecipes set the Recipes field

func (*UserFactory) SetRecipesPost

func (f *UserFactory) SetRecipesPost(i int) *UserBuilder

SetRecipesPost call the post function with int input

func (*UserFactory) SetTags

func (f *UserFactory) SetTags(i []*model.Category) *UserBuilder

SetTags set the Tags field

type UserMetaFactory

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

func (*UserMetaFactory) Build

func (f *UserMetaFactory) Build() *UserFactory

Build create a UserFactory from UserMetaFactory

func (*UserMetaFactory) SetAfterCreateFunc

func (f *UserMetaFactory) SetAfterCreateFunc(fn func(ctx context.Context, i *model.User) error) *UserMetaFactory

SetAfterCreateFunc register a function to be called after struct create

func (*UserMetaFactory) SetBeforeCreateFunc added in v0.1.1

func (f *UserMetaFactory) SetBeforeCreateFunc(fn func(ctx context.Context, i *model.User) error) *UserMetaFactory

SetBeforeCreateFunc register a function to be called before struct create

func (*UserMetaFactory) SetNameDefault

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

SetNameDefault assign a default value to Name field

func (*UserMetaFactory) SetNameFactory

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

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 (*UserMetaFactory) SetNameLazy

func (f *UserMetaFactory) SetNameLazy(fn func(ctx context.Context, i *model.User) (string, error)) *UserMetaFactory

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

func (*UserMetaFactory) SetNameSequence

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

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

func (*UserMetaFactory) SetRecipesDefault

func (f *UserMetaFactory) SetRecipesDefault(v []*model.Recipe) *UserMetaFactory

SetRecipesDefault assign a default value to Recipes field

func (*UserMetaFactory) SetRecipesFactory

func (f *UserMetaFactory) SetRecipesFactory(fn func(ctx context.Context) ([]*model.Recipe, error)) *UserMetaFactory

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

func (*UserMetaFactory) SetRecipesLazy

func (f *UserMetaFactory) SetRecipesLazy(fn func(ctx context.Context, i *model.User) ([]*model.Recipe, error)) *UserMetaFactory

SetRecipesLazy register a function which accept the build struct and set return value to Recipes field

func (*UserMetaFactory) SetRecipesPostFunc

func (f *UserMetaFactory) SetRecipesPostFunc(fn func(ctx context.Context, set bool, obj *model.User, i int) error) *UserMetaFactory

SetRecipesPostFunc register a post function which will be called in factory SetRecipesPost method

func (*UserMetaFactory) SetRecipesSequence

func (f *UserMetaFactory) SetRecipesSequence(fn func(ctx context.Context, i int) ([]*model.Recipe, error)) *UserMetaFactory

SetRecipesSequence register a function which accept a sequence counter and set return value to Recipes field

func (*UserMetaFactory) SetTagsDefault

func (f *UserMetaFactory) SetTagsDefault(v []*model.Category) *UserMetaFactory

SetTagsDefault assign a default value to Tags field

func (*UserMetaFactory) SetTagsFactory

func (f *UserMetaFactory) SetTagsFactory(fn func(ctx context.Context) ([]*model.Category, error)) *UserMetaFactory

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

func (*UserMetaFactory) SetTagsLazy

func (f *UserMetaFactory) SetTagsLazy(fn func(ctx context.Context, i *model.User) ([]*model.Category, error)) *UserMetaFactory

SetTagsLazy register a function which accept the build struct and set return value to Tags field

func (*UserMetaFactory) SetTagsSequence

func (f *UserMetaFactory) SetTagsSequence(fn func(ctx context.Context, i int) ([]*model.Category, error)) *UserMetaFactory

SetTagsSequence register a function which accept a sequence counter and set return value to Tags field

Jump to

Keyboard shortcuts

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