entx

package
v0.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package entx is a package of tools for interacting with ent

Index

Constants

This section is empty.

Variables

View Source
var CascadeAnnotationName = "DATUM_CASCADE"

CascadeAnnotationName is a name for our cascading delete annotation

View Source
var SchemaGenAnnotationName = "DATUM_SCHEMAGEN"

Functions

func MarshalRawMessage

func MarshalRawMessage(t json.RawMessage) graphql.Marshaler

MarshalRawMessage provides a graphql.Marshaler for json.RawMessage

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 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

func (*Extension) Templates

func (e *Extension) Templates() []*gen.Template

Templates of the extension

type ExtensionOption

type ExtensionOption func(*Extension) error

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL