Documentation ¶
Index ¶
- Variables
- type Args
- type Factory
- func (fa *Factory) Attr(name string, gen func(Args) (interface{}, error)) *Factory
- func (fa *Factory) Construct(ptr interface{}) error
- func (fa *Factory) ConstructWithContextAndOption(ctx context.Context, ptr interface{}, opt map[string]interface{}) error
- func (fa *Factory) ConstructWithOption(ptr interface{}, opt map[string]interface{}) error
- func (fa *Factory) Create() (interface{}, error)
- func (fa *Factory) CreateWithContext(ctx context.Context) (interface{}, error)
- func (fa *Factory) CreateWithContextAndOption(ctx context.Context, opt map[string]interface{}) (interface{}, error)
- func (fa *Factory) CreateWithOption(opt map[string]interface{}) (interface{}, error)
- func (fa *Factory) MustCreate() interface{}
- func (fa *Factory) MustCreateWithContextAndOption(ctx context.Context, opt map[string]interface{}) interface{}
- func (fa *Factory) MustCreateWithOption(opt map[string]interface{}) interface{}
- func (fa *Factory) OnCreate(cb func(Args) error) *Factory
- func (fa *Factory) SeqInt(name string, gen func(int) (interface{}, error)) *Factory
- func (fa *Factory) SeqInt64(name string, gen func(int64) (interface{}, error)) *Factory
- func (fa *Factory) SeqString(name string, gen func(string) (interface{}, error)) *Factory
- func (fa *Factory) SubFactory(name string, sub *Factory) *Factory
- func (fa *Factory) SubRecursiveFactory(name string, sub *Factory, getLimit func() int) *Factory
- func (fa *Factory) SubRecursiveSliceFactory(name string, sub *Factory, getSize, getLimit func() int) *Factory
- func (fa *Factory) SubSliceFactory(name string, sub *Factory, getSize func() int) *Factory
- type Stacks
Constants ¶
This section is empty.
Variables ¶
View Source
var (
TagName = "factory"
)
Functions ¶
This section is empty.
Types ¶
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
func NewFactory ¶
func NewFactory(model interface{}) *Factory
NewFactory returns a new factory for specified model class Each generator is applied in the order in which they are declared
func (*Factory) Construct ¶
Bind values of a new objects to a pointer to struct.
ptr: a pointer to struct
func (*Factory) ConstructWithContextAndOption ¶
func (fa *Factory) ConstructWithContextAndOption(ctx context.Context, ptr interface{}, opt map[string]interface{}) error
Bind values of a new objects to a pointer to struct with context and option.
ctx: context object ptr: a pointer to struct opt: attibute values
func (*Factory) ConstructWithOption ¶
Bind values of a new objects to a pointer to struct with option.
ptr: a pointer to struct opt: attibute values
func (*Factory) CreateWithContext ¶
func (*Factory) CreateWithContextAndOption ¶
func (*Factory) CreateWithOption ¶
func (*Factory) MustCreate ¶
func (fa *Factory) MustCreate() interface{}
func (*Factory) MustCreateWithContextAndOption ¶
func (*Factory) MustCreateWithOption ¶
func (*Factory) OnCreate ¶
OnCreate registers a callback on object creation. If callback function returns error, object creation is failed.
func (*Factory) SubRecursiveFactory ¶
func (*Factory) SubRecursiveSliceFactory ¶
Click to show internal directories.
Click to hide internal directories.