nauyey / factory Goto Github PK
View Code? Open in Web Editor NEWA package for setting up Golang structs as test data.
License: Other
A package for setting up Golang structs as test data.
License: Other
I'm trying to implement simple factory, using an example from Readme, but getting next error:
cannot use func literal (type func(int64) interface {}) as type factory.SequenceFieldValue in argument to def.SequenceField
here is my code
import (
"github.com/nauyey/factory/def"
"fmt"
)
type Customer struct {
Name string
}
var CustomerFactory = def.NewFactory(Customer{}, "",
def.SequenceField("Name", 1, func(n int64) interface{} {
return fmt.Sprint("Name", n)
}),
)
I use version: v0.2.0, revision: "a3bf873c5a1323620b4bfaf180453093f3928b69"
Duplicated field definitions under same def.NewFactory
/def.Trait
/def.Association
will be very confusing. It should be detected and fail during defining a factory.
Associations definition circle will cause an endless loop when using a strategy to create or build a instance.
Detect associations definition circle and fail the definition.
Some thing as following:
Before
err := Build(userFactory, WithField("Name", "Tony")).To(user)
if err != nil {
// handle error
}
After
Must(Build(userFactory, WithField("Name", "Tony"))).To(user)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.