Documentation ¶
Overview ¶
Package factory is a generated GoMock package.
Index ¶
- Variables
- type Args
- type Factory
- func (fa *Factory) Attr(name string, gen Generator, formatters ...Formatter) *Factory
- func (fa *Factory) Clean()
- func (fa *Factory) Construct(ptr any) error
- func (fa *Factory) ConstructWithContextAndOption(ctx context.Context, ptr any, opt map[string]any) error
- func (fa *Factory) ConstructWithOption(ptr any, opt map[string]any) error
- func (fa *Factory) Create() (any, error)
- func (fa *Factory) CreateWithContext(ctx context.Context) (any, error)
- func (fa *Factory) CreateWithContextAndOption(ctx context.Context, opt map[string]any) (any, error)
- func (fa *Factory) CreateWithOption(opt map[string]any) (any, error)
- func (fa *Factory) CreateX() any
- func (fa *Factory) CreateXWithContextAndOption(ctx context.Context, opt map[string]any) any
- func (fa *Factory) CreateXWithOption(opt map[string]any) any
- func (fa *Factory) File(name, ext string, gen func(*os.File) (any, error), formatters ...Formatter) *Factory
- func (fa *Factory) FileWithDir(name, ext, dir string, gen func(*os.File) (any, error), ...) *Factory
- func (fa *Factory) Jpg(name string, gen func(*os.File) (any, error), formatters ...Formatter) *Factory
- func (fa *Factory) MustCreate() any
- func (fa *Factory) MustCreateWithContextAndOption(ctx context.Context, opt map[string]any) any
- func (fa *Factory) MustCreateWithOption(opt map[string]any) any
- func (fa *Factory) OnCreate(cb func(Args) error) *Factory
- func (fa *Factory) Png(name string, gen func(*os.File) (any, error), formatters ...Formatter) *Factory
- func (fa *Factory) SeqInt(name string, gen func(int) (any, error), formatters ...Formatter) *Factory
- func (fa *Factory) SeqInt64(name string, gen func(int64) (any, error), formatters ...Formatter) *Factory
- func (fa *Factory) SeqString(name string, gen func(string) (any, error), formatters ...Formatter) *Factory
- func (fa *Factory) SubFactory(name string, sub *Factory, formatters ...Formatter) *Factory
- func (fa *Factory) SubRecursiveFactory(name string, sub *Factory, getLimit func() int, formatters ...Formatter) *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, formatters ...Formatter) *Factory
- type Formatter
- type Generator
- type MockArgs
- type MockArgsMockRecorder
- type Stacks
Constants ¶
This section is empty.
Variables ¶
var (
TagName = "factory"
)
Functions ¶
This section is empty.
Types ¶
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
func NewFactory ¶
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 any, opt map[string]any) 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) CreateXWithContextAndOption ¶
func (*Factory) File ¶
func (fa *Factory) File(name, ext string, gen func(*os.File) (any, error), formatters ...Formatter) *Factory
Default directory containing temporary files is "dir" directory at the same level of directory executing commands. ext is extension eg "txt", "bat", "xlsx", etc
func (*Factory) FileWithDir ¶
func (fa *Factory) FileWithDir(name, ext, dir string, gen func(*os.File) (any, error), formatters ...Formatter) *Factory
You should call Clean function in defer after invoking FileWithDir function (See Clean) to clean all unused files. Otherwise, files will not be removed
func (*Factory) Jpg ¶
func (fa *Factory) Jpg(name string, gen func(*os.File) (any, error), formatters ...Formatter) *Factory
Jpg function is a shortcut for creating jpg files. No file name is required. For specifying file name, see File function
func (*Factory) MustCreate ¶
MustCreate will be deprecated in future releases. Please use CreateX instead.
func (*Factory) MustCreateWithContextAndOption ¶
MustCreateWithContextAndOption will be deprecated in future releases. Please use CreateXWithContextAndOption instead.
func (*Factory) MustCreateWithOption ¶
MustCreateWithOption will be deprecated in future releases. Please use CreateXWithOption instead.
func (*Factory) OnCreate ¶
OnCreate registers a callback on object creation. If callback function returns error, object creation is failed.
func (*Factory) Png ¶
func (fa *Factory) Png(name string, gen func(*os.File) (any, error), formatters ...Formatter) *Factory
Png function is a shortcut for creating png files. No file name is required. For specifying file name, see File function
func (*Factory) SubFactory ¶
func (*Factory) SubRecursiveFactory ¶
func (*Factory) SubRecursiveSliceFactory ¶
type MockArgs ¶
type MockArgs struct {
// contains filtered or unexported fields
}
MockArgs is a mock of Args interface.
func NewMockArgs ¶
func NewMockArgs(ctrl *gomock.Controller) *MockArgs
NewMockArgs creates a new mock instance.
func (*MockArgs) EXPECT ¶
func (m *MockArgs) EXPECT() *MockArgsMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockArgsMockRecorder ¶
type MockArgsMockRecorder struct {
// contains filtered or unexported fields
}
MockArgsMockRecorder is the mock recorder for MockArgs.
func (*MockArgsMockRecorder) Context ¶
func (mr *MockArgsMockRecorder) Context() *gomock.Call
Context indicates an expected call of Context.
func (*MockArgsMockRecorder) Instance ¶
func (mr *MockArgsMockRecorder) Instance() *gomock.Call
Instance indicates an expected call of Instance.
func (*MockArgsMockRecorder) Parent ¶
func (mr *MockArgsMockRecorder) Parent() *gomock.Call
Parent indicates an expected call of Parent.