Documentation
¶
Overview ¶
Package entx is a package of tools for interacting with ent
Index ¶
- Variables
- func CheckIsSoftDelete(ctx context.Context) bool
- func CheckSkipSoftDelete(ctx context.Context) bool
- func IsSoftDelete(parent context.Context) context.Context
- func MarshalRawMessage(t json.RawMessage) graphql.Marshaler
- func SkipSoftDelete(parent context.Context) context.Context
- func UnmarshalRawMessage(v interface{}) (json.RawMessage, error)
- type CascadeAnnotation
- type CascadeThroughAnnotation
- type Extension
- type ExtensionOption
- type SchemaGenAnnotation
- type SoftDeleteKey
- type SoftDeleteSkipKey
- type ThroughCleanup
Constants ¶
This section is empty.
Variables ¶
var CascadeAnnotationName = "DATUM_CASCADE"
CascadeAnnotationName is a name for our cascading delete annotation
var CascadeThroughAnnotationName = "DATUM_CASCADE_THROUGH"
CascadeThroughAnnotationName is a name for our cascading through edge delete annotation
var SchemaGenAnnotationName = "DATUM_SCHEMAGEN"
SchemaGenAnnotationName is a name for our graphql schema generation annotation
Functions ¶
func CheckIsSoftDelete ¶ added in v0.2.7
CheckIsSoftDelete checks if the softDeleteKey is set in the context
func CheckSkipSoftDelete ¶ added in v0.2.7
CheckSkipSoftDelete checks if the SoftDeleteSkipKey is set in the context
func IsSoftDelete ¶ added in v0.2.7
IsSoftDelete returns a new context that informs the delete is a soft-delete for interceptor/hooks.
func MarshalRawMessage ¶
func MarshalRawMessage(t json.RawMessage) graphql.Marshaler
MarshalRawMessage provides a graphql.Marshaler for json.RawMessage
func SkipSoftDelete ¶ added in v0.2.7
SkipSoftDelete returns a new context that skips the soft-delete interceptor/hooks.
func UnmarshalRawMessage ¶
func UnmarshalRawMessage(v interface{}) (json.RawMessage, error)
UnmarshalRawMessage provides a graphql.Unmarshaler for json.RawMessage
Types ¶
type CascadeAnnotation ¶
type CascadeAnnotation struct {
Field string
}
CascadeAnnotation is an annotation used to indicate that an edge should be cascaded
func CascadeAnnotationField ¶
func CascadeAnnotationField(fieldname string) *CascadeAnnotation
CascadeAnnotationField sets the field name of the edge containing the ID of a record from the current schema
func (CascadeAnnotation) Name ¶
func (a CascadeAnnotation) Name() string
Name returns the name of the CascadeAnnotation
type CascadeThroughAnnotation ¶ added in v0.2.5
type CascadeThroughAnnotation struct {
Schemas []ThroughCleanup
}
CascadeThroughAnnotation is an annotation used to indicate that an edge should be cascaded through
func CascadeThroughAnnotationField ¶ added in v0.2.5
func CascadeThroughAnnotationField(schemas []ThroughCleanup) *CascadeThroughAnnotation
CascadeThroughAnnotationField sets the field name of the edge containing the ID of a record from the current schema
func (CascadeThroughAnnotation) Name ¶ added in v0.2.5
func (a CascadeThroughAnnotation) Name() string
Name returns the name of the CascadeThroughAnnotation
type Extension ¶
type Extension struct {
entc.DefaultExtension
// contains filtered or unexported fields
}
Extension is an implementation of entc.Extension
func NewExtension ¶
func NewExtension(opts ...ExtensionOption) (*Extension, error)
NewExtension returns an entc Extension that allows the entx package to generate the schema changes and templates needed to function
func (*Extension) GQLSchemaHooks ¶
func (e *Extension) GQLSchemaHooks() []entgql.SchemaHook
GQLSchemaHooks of the extension to seamlessly edit the final gql interface
type ExtensionOption ¶
ExtensionOption allow for control over the behavior of the generator
func WithJSONScalar ¶
func WithJSONScalar() ExtensionOption
WithJSONScalar adds the JSON scalar definition
type SchemaGenAnnotation ¶ added in v0.2.4
type SchemaGenAnnotation struct {
Skip bool
}
func SchemaGenSkip ¶ added in v0.2.4
func SchemaGenSkip(skip bool) *SchemaGenAnnotation
SchemaGenSkip sets the whether schema generation should be skipped for this type
func (SchemaGenAnnotation) Name ¶ added in v0.2.4
func (a SchemaGenAnnotation) Name() string
type SoftDeleteKey ¶ added in v0.2.7
type SoftDeleteKey struct{}
SoftDeleteKey is used to indicate a soft delete mutation is in progress
type SoftDeleteSkipKey ¶ added in v0.2.7
type SoftDeleteSkipKey struct{}
SoftDeleteSkipKey is used to indicate to allow soft deleted records to be returned in records and to skip soft delete on mutations and proceed with a regular delete