Documentation ¶
Index ¶
- Constants
- Variables
- func AddFuncMap(fm template.FuncMap)
- func ULID(v any, err error) ulid.ULID
- type CommandDependency
- type CommandFunc
- type CommandInput
- type CommandOutput
- type Config
- type Database
- type Edge
- type Fixture
- func (f *Fixture) Applied() bool
- func (f *Fixture) Apply() error
- func (f *Fixture) Edge(uid, vid int64) graph.Edge
- func (f *Fixture) From(id int64) graph.Nodes
- func (f *Fixture) GetField(table, key, field string) (any, error)
- func (f *Fixture) GetNode(label [2]string) *Node
- func (f *Fixture) HasEdgeBetween(xid, yid int64) bool
- func (f *Fixture) HasEdgeFromTo(uid, vid int64) bool
- func (f *Fixture) Node(id int64) graph.Node
- func (f *Fixture) Nodes() graph.Nodes
- func (f *Fixture) ParseTemplate(body []byte) ([]byte, error)
- func (f *Fixture) SetField(table, key, field string, value any) error
- func (f *Fixture) To(id int64) graph.Nodes
- type Node
- type Nodes
- type PostgresWriter
- type Record
- type RecordError
- type RedisWriter
- type Table
- type TableOptions
- type Writer
Constants ¶
View Source
const ( WriteAsync = 1 WriteSync = 2 )
Variables ¶
View Source
var ErrDatabaseNotFound = errors.New("database not found")
View Source
var ErrFieldNotFound = errors.New("field not found")
View Source
var ErrPrimaryKeyUndefined = errors.New("primary key undefined")
View Source
var ErrRecordNotFound = errors.New("record not found")
View Source
var ErrTableNotFound = errors.New("table not found")
Functions ¶
func AddFuncMap ¶
Types ¶
type CommandDependency ¶ added in v0.4.0
type CommandFunc ¶
type CommandFunc func(in *CommandInput) (*CommandOutput, error)
type CommandInput ¶
type CommandOutput ¶
type CommandOutput struct { Dependencies []*CommandDependency IsUpdate bool Value any }
type Config ¶
type Config struct { // The default name for the primary key field. // This value can be overwritten by TableOptions. // Default: "id" PrimaryKeyName string // The default references for all tables. // Can be overwritten by TableOptions. References map[string]string // Whether to write records asynchronously or synchronously. // Default: WriteAsync WriteMode int // TableOptions can be used to set table specific options or // create multiple profiles for the same table. E.g.: // // tableOptions := map[string]*fixture.TableOptions{ // "foo": { // DefaultValues: fixture.Record{ // "bar": "default value", // }, // }, // "foo#profile2": { // TableName: "foo", // DefaultValues: fixture.Record{ // "bar": "profile2 value", // }, // }, // } TableOptions map[string]*TableOptions // contains filtered or unexported fields }
func (*Config) GetReference ¶
GetReference checks if the given field has a reference and returns its table and field names. If no reference is found, both values are empty and no error is returned.
func (*Config) TableAlias ¶
type Edge ¶
type Edge struct {
// contains filtered or unexported fields
}
func (*Edge) ReversedEdge ¶
type Fixture ¶
type Fixture struct { Context context.Context Logger *zerolog.Logger // Config are a set of parameters that can be reused across fixtures, // and should only be set once. Config *Config // The writer used for this runner. Writer Writer // The directory where fixture files are located. // If non-empty, will be prepended to File. Dir string // TODO: Should check for one of? File string Body io.Reader BodyFormat string // Database can be used to set an initial database state. // Any records defined in the File/Body will be merged with // the ones defined here. Database Database // If defined, the fixture body will be parsed as a Go text/template string // and executed with TemplateData as its data. TemplateData map[string]any PrintJSON bool DoNotCreateDependencies bool // contains filtered or unexported fields }
func (*Fixture) HasEdgeBetween ¶
func (*Fixture) HasEdgeFromTo ¶
func (*Fixture) ParseTemplate ¶ added in v0.5.0
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func (*Node) AppendFrom ¶
type PostgresWriter ¶
type RecordError ¶
func (*RecordError) Error ¶
func (e *RecordError) Error() string
type Table ¶
func GetDefaultValues ¶
type TableOptions ¶
Click to show internal directories.
Click to hide internal directories.