Documentation ¶
Index ¶
- func BuildFields(buildFieldsFn func() FieldMap) func(*EntMutationBuilder)
- func ExistingEnt(existingEnt ent.Entity) func(*EntMutationBuilder)
- func GetChangeset(action Action) (ent.Changeset, error)
- func MultiChangesets(changesetFn ...func() (ent.Changeset, error)) (ent.Changeset, error)
- func Save(action Action) error
- type Action
- type ActionPermissionsError
- type ActionWithObservers
- type ActionWithPermissions
- type ActionWithTriggers
- type ActionWithValidator
- type ActionWithValidators
- type ChangesetWithObservers
- type ChangesetWithValidators
- type EdgeGroupMutationBuilder
- type EntMutationBuilder
- func (b *EntMutationBuilder) AddInboundEdge(edgeType ent.EdgeType, id1 interface{}, nodeType ent.NodeType, ...) error
- func (b *EntMutationBuilder) AddOutboundEdge(edgeType ent.EdgeType, id2 interface{}, nodeType ent.NodeType, ...) error
- func (b *EntMutationBuilder) Entity() ent.Entity
- func (b *EntMutationBuilder) ExistingEnt() ent.Entity
- func (b *EntMutationBuilder) GetChangeset() (ent.Changeset, error)
- func (b *EntMutationBuilder) GetOperation() ent.WriteOperation
- func (b *EntMutationBuilder) GetPlaceholderID() string
- func (b *EntMutationBuilder) GetRawFields() map[string]interface{}
- func (b *EntMutationBuilder) GetViewer() viewer.ViewerContext
- func (b *EntMutationBuilder) OverrideRawField(key string, val interface{})
- func (b *EntMutationBuilder) RemoveInboundEdge(edgeType ent.EdgeType, id1 string, nodeType ent.NodeType) error
- func (b *EntMutationBuilder) RemoveOutboundEdge(edgeType ent.EdgeType, id2 string, nodeType ent.NodeType) error
- func (b *EntMutationBuilder) SetObservers(observers []Observer)
- func (b *EntMutationBuilder) SetRawFields(m map[string]interface{})
- func (b *EntMutationBuilder) SetTriggers(triggers []Trigger)
- func (b *EntMutationBuilder) SetValidators(validators []Validator)
- func (b *EntMutationBuilder) Validate() error
- type EntMutationChangeset
- func (c *EntMutationChangeset) Changesets() []ent.Changeset
- func (c *EntMutationChangeset) Dependencies() ent.MutationBuilderMap
- func (c *EntMutationChangeset) EntConfig() ent.Config
- func (c *EntMutationChangeset) Entity() ent.Entity
- func (c *EntMutationChangeset) ExistingEnt() ent.Entity
- func (c *EntMutationChangeset) GetExecutor() ent.Executor
- func (c *EntMutationChangeset) GetPlaceholderID() string
- func (c *EntMutationChangeset) GetViewer() viewer.ViewerContext
- func (c *EntMutationChangeset) Observers() []Observer
- func (c *EntMutationChangeset) Validators() []Validator
- type FieldInfo
- type FieldMap
- type Observer
- type Trigger
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildFields ¶
func BuildFields(buildFieldsFn func() FieldMap) func(*EntMutationBuilder)
func ExistingEnt ¶
func ExistingEnt(existingEnt ent.Entity) func(*EntMutationBuilder)
func MultiChangesets ¶
Types ¶
type Action ¶
type Action interface { GetViewer() viewer.ViewerContext // this exists and is just called by clients e.g. in triggers // and the generated code calls actions.GetChangeset() which calls GetBuilder GetChangeset() (ent.Changeset, error) // where new ent should be stored. // (TODO:ola) not really needed since builder has all this Entity() ent.Entity GetBuilder() ent.MutationBuilder }
type ActionPermissionsError ¶
type ActionPermissionsError struct{}
func (*ActionPermissionsError) Error ¶
func (err *ActionPermissionsError) Error() string
type ActionWithObservers ¶
type ActionWithPermissions ¶
type ActionWithPermissions interface { Action GetPrivacyPolicy() ent.PrivacyPolicy }
type ActionWithTriggers ¶
type ActionWithValidator ¶
type ActionWithValidators ¶
type ChangesetWithObservers ¶
type ChangesetWithValidators ¶
type EdgeGroupMutationBuilder ¶
type EdgeGroupMutationBuilder struct { *EntMutationBuilder // contains filtered or unexported fields }
func NewEdgeGroupMutationBuilder ¶
func NewEdgeGroupMutationBuilder( b *EntMutationBuilder, statusMap ent.AssocStatusMap, ) *EdgeGroupMutationBuilder
func (*EdgeGroupMutationBuilder) GetChangeset ¶
func (b *EdgeGroupMutationBuilder) GetChangeset() (ent.Changeset, error)
func (*EdgeGroupMutationBuilder) SetEnumValue ¶
func (b *EdgeGroupMutationBuilder) SetEnumValue(enumValue string)
func (*EdgeGroupMutationBuilder) SetIDValue ¶
func (b *EdgeGroupMutationBuilder) SetIDValue(idValue string, nodeType ent.NodeType)
type EntMutationBuilder ¶
type EntMutationBuilder struct { Viewer viewer.ViewerContext ExistingEntity ent.Entity Operation ent.WriteOperation EntConfig ent.Config // contains filtered or unexported fields }
fields in generated builder not in actions bug in in having it in actions now because if we set something in actions that's not there, there'll be an issue TODO rename to [Base|Abstract]MutationBuilder or something like that
func NewMutationBuilder ¶
func NewMutationBuilder( v viewer.ViewerContext, operation ent.WriteOperation, entity ent.Entity, entConfig ent.Config, opts ...func(*EntMutationBuilder), ) *EntMutationBuilder
TODO have this just take a loader...
func (*EntMutationBuilder) AddInboundEdge ¶
func (b *EntMutationBuilder) AddInboundEdge( edgeType ent.EdgeType, id1 interface{}, nodeType ent.NodeType, options ...func(*ent.EdgeOperation)) error
func (*EntMutationBuilder) AddOutboundEdge ¶
func (b *EntMutationBuilder) AddOutboundEdge(edgeType ent.EdgeType, id2 interface{}, nodeType ent.NodeType, options ...func(*ent.EdgeOperation)) error
func (*EntMutationBuilder) Entity ¶
func (b *EntMutationBuilder) Entity() ent.Entity
func (*EntMutationBuilder) ExistingEnt ¶
func (b *EntMutationBuilder) ExistingEnt() ent.Entity
func (*EntMutationBuilder) GetChangeset ¶
func (b *EntMutationBuilder) GetChangeset() (ent.Changeset, error)
Note that this shouldn't be called directly Need to pass things to it to work correctly all of these should be passed in constructor? TODO refactor this and construction so that calling action.Validate() works shouldn't need the workarounds we did for GetChangeset e.g ent.Save()
func (*EntMutationBuilder) GetOperation ¶
func (b *EntMutationBuilder) GetOperation() ent.WriteOperation
func (*EntMutationBuilder) GetPlaceholderID ¶
func (b *EntMutationBuilder) GetPlaceholderID() string
func (*EntMutationBuilder) GetRawFields ¶
func (b *EntMutationBuilder) GetRawFields() map[string]interface{}
func (*EntMutationBuilder) GetViewer ¶
func (b *EntMutationBuilder) GetViewer() viewer.ViewerContext
func (*EntMutationBuilder) OverrideRawField ¶
func (b *EntMutationBuilder) OverrideRawField(key string, val interface{})
func (*EntMutationBuilder) RemoveInboundEdge ¶
func (*EntMutationBuilder) RemoveOutboundEdge ¶
func (*EntMutationBuilder) SetObservers ¶
func (b *EntMutationBuilder) SetObservers(observers []Observer)
func (*EntMutationBuilder) SetRawFields ¶
func (b *EntMutationBuilder) SetRawFields(m map[string]interface{})
func (*EntMutationBuilder) SetTriggers ¶
func (b *EntMutationBuilder) SetTriggers(triggers []Trigger)
func (*EntMutationBuilder) SetValidators ¶
func (b *EntMutationBuilder) SetValidators(validators []Validator)
func (*EntMutationBuilder) Validate ¶
func (b *EntMutationBuilder) Validate() error
type EntMutationChangeset ¶
type EntMutationChangeset struct {
// contains filtered or unexported fields
}
func (*EntMutationChangeset) Changesets ¶
func (c *EntMutationChangeset) Changesets() []ent.Changeset
func (*EntMutationChangeset) Dependencies ¶
func (c *EntMutationChangeset) Dependencies() ent.MutationBuilderMap
func (*EntMutationChangeset) EntConfig ¶
func (c *EntMutationChangeset) EntConfig() ent.Config
func (*EntMutationChangeset) Entity ¶
func (c *EntMutationChangeset) Entity() ent.Entity
func (*EntMutationChangeset) ExistingEnt ¶
func (c *EntMutationChangeset) ExistingEnt() ent.Entity
func (*EntMutationChangeset) GetExecutor ¶
func (c *EntMutationChangeset) GetExecutor() ent.Executor
func (*EntMutationChangeset) GetPlaceholderID ¶
func (c *EntMutationChangeset) GetPlaceholderID() string
func (*EntMutationChangeset) GetViewer ¶
func (c *EntMutationChangeset) GetViewer() viewer.ViewerContext
func (*EntMutationChangeset) Observers ¶
func (c *EntMutationChangeset) Observers() []Observer
func (*EntMutationChangeset) Validators ¶
func (c *EntMutationChangeset) Validators() []Validator
type FieldInfo ¶
type FieldInfo struct { // The field as defined by the developer Field *field.Field // The value provided by the end user Value interface{} }
FieldInfo represents the information from the action passed to EntMutationBuilder.
type FieldMap ¶
FieldMap is a named type for a map of field names to FieldInfo. Generated by the ent framework for actions
type Observer ¶
type Observer interface {
Observe() error
}
Observer is something that's run after an action has been run This is where things like send email, send push notification etc are run They are run IFF the action succeeds. They are not run within the transaction where the action, trigger, validator etc all runs