Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine interface { // Applies specified mutation to target provided. Mutate(ctx context.Context, target, mutation interface{}) (err error) }
Engine is component responsible for applying mutations passed into it. Typically, there is single global mutator handling all types.
func NewDefaultEngine ¶
func NewDefaultEngine() (mutator Engine)
type MongoEngine ¶
type MongoEngine interface {
RenderMongoMutation(ctx context.Context, targetType reflect.Type, mutation interface{}) (res interface{}, err error)
}
Mutator, which is able to apply mutations to mongo objects.
func NewMongoEngine ¶
func NewMongoEngine() (mutator MongoEngine)
type MongoMutator ¶
type MongoMutator interface { Mutator // Returns mongo mutation name, so appropriate bson.D can be passed. MongoMutationName() string RenderMongoDoc(ctx context.Context, data MongoMutatorData) (entry bson.E, err error) }
Mutation, which is able to render itself as mongodb mutation.
type MongoMutatorData ¶
type MongoMutatorData struct { MutatorData BSONFieldName string Skip bool }
type MutationArgs ¶
func (MutationArgs) GetFirst ¶
func (args MutationArgs) GetFirst(arg string) string
func (MutationArgs) IsSet ¶
func (args MutationArgs) IsSet(arg string) bool
type Mutator ¶
type Mutator interface {
ApplyMutation(ctx context.Context, target reflect.Value, field stdesc.Field, data MutatorData) (err error)
}
Mutator is part of DefaultMutator, which applies mutation using data it's given.
type MutatorData ¶
type MutatorData struct { Value interface{} Args MutationArgs FieldName string MutationName string }
Click to show internal directories.
Click to hide internal directories.