Documentation ¶
Index ¶
- Constants
- func CompareFieldInfo(f1, f2 *FieldInfo) ([]change.Change, error)
- func CompareNonEntField(existing, field *NonEntField) []change.Change
- func FieldEqual(existing, field *Field) bool
- func FieldsEqual(fields1, fields2 []*Field) bool
- func NonEntFieldEqual(existing, field *NonEntField) bool
- func NonEntFieldsEqual(existing, fields []*NonEntField) bool
- func NormalizedField(s string) string
- type CustomInterfaceGetter
- type CustomTypeWithHasConvertFunction
- type EditableContext
- type Field
- func (f *Field) AddFieldEdgeToEdgeInfo(cfg codegenapi.Config, edgeInfo *edge.EdgeInfo, ...) error
- func (f *Field) AddForeignKeyEdgeToInverseEdgeInfo(cfg codegenapi.Config, edgeInfo *edge.EdgeInfo, nodeName string) error
- func (f *Field) AddForeignKeyFieldEdgeToEdgeInfo(cfg codegenapi.Config, edgeInfo *edge.EdgeInfo, ...) error
- func (f *Field) AddInverseEdge(cfg codegenapi.Config, edge *edge.AssociationEdge) error
- func (f *Field) CamelCaseName() string
- func (f *Field) Clone(opts ...Option) (*Field, error)
- func (f *Field) CreateDBColumn() bool
- func (f *Field) DefaultToViewerOnCreate() bool
- func (f *Field) DefaultValue() *string
- func (f *Field) EditableField(ctx EditableContext) bool
- func (f *Field) EditableGraphQLField() bool
- func (f *Field) EmbeddableInParentAction() bool
- func (f *Field) EvolvedIDField() bool
- func (f *Field) ExposeFieldOrFieldEdgeToGraphQL() bool
- func (f *Field) ExposeToActionsByDefault() bool
- func (f *Field) ExposeToGraphQL() bool
- func (f *Field) FetchOnDemand() bool
- func (f *Field) FetchOnLoad() bool
- func (f *Field) FieldEdgeInfo() *base.FieldEdgeInfo
- func (f *Field) ForceOptionalInAction() bool
- func (f *Field) ForceRequiredInAction() bool
- func (f *Field) ForeignKeyInfo() *ForeignKeyInfo
- func (f *Field) GetConvertImport(cfg codegenapi.Config, g CustomInterfaceGetter) *tsimport.ImportPath
- func (f *Field) GetConvertMethod(cfg codegenapi.Config) string
- func (f *Field) GetDbColName() string
- func (f *Field) GetDbTypeForField() string
- func (f *Field) GetFieldNameInStruct() string
- func (f *Field) GetFieldType() enttype.Type
- func (f *Field) GetGraphQLName() string
- func (f *Field) GetGraphQLTypeForField() string
- func (f *Field) GetImmutableOverrideFieldNameInBuilder() string
- func (f *Field) GetImportsForTypes(cfg codegenapi.Config, g CustomInterfaceGetter, s enttype.SchemaType) []*tsimport.ImportPath
- func (f *Field) GetInverseEdge() *edge.AssociationEdge
- func (f *Field) GetNotNullableTsType() string
- func (f *Field) GetPatternName() string
- func (f *Field) GetPossibleTypes() []enttype.Type
- func (f *Field) GetQuotedDBColName() string
- func (f *Field) GetTSFieldType(cfg codegenapi.Config) enttype.Type
- func (f *Field) GetTSGraphQLTypeForFieldImports(input bool) []*tsimport.ImportPath
- func (f *Field) GetTSMutationGraphQLTypeForFieldImports(forceOptional, input bool) []*tsimport.ImportPath
- func (f *Field) GetTsType() string
- func (f *Field) GetTsTypeImports() []*tsimport.ImportPath
- func (f *Field) GetUserConvert() *input.UserConvertType
- func (f *Field) HasAsyncAccessor(cfg codegenapi.Config) bool
- func (f *Field) HasConvertFunction(cfg codegenapi.Config, g CustomInterfaceGetter) bool
- func (f *Field) HasDefaultValueOnCreate() bool
- func (f *Field) HasDefaultValueOnEdit() bool
- func (f *Field) HasEditFieldPrivacy() bool
- func (f *Field) HasFieldPrivacy() bool
- func (f *Field) IDField() bool
- func (f *Field) IDType() bool
- func (f *Field) Index() bool
- func (f *Field) InstanceFieldName() string
- func (f *Field) IsEditableIDField(ctx EditableContext) bool
- func (f *Field) Nullable() bool
- func (f *Field) PatternField() bool
- func (f *Field) Private(cfg codegenapi.Config) bool
- func (f *Field) QueryFromEnt() bool
- func (f *Field) QueryFromEntName() string
- func (f *Field) SingleFieldPrimaryKey() bool
- func (f *Field) TSBuilderWithRelativeType(cfg codegenapi.Config) string
- func (f *Field) TSPublicAPIName() string
- func (f *Field) TsActualType() string
- func (f *Field) TsBuilderFieldName() string
- func (f *Field) TsBuilderImports(cfg codegenapi.Config) []*tsimport.ImportPath
- func (f *Field) TsBuilderType(cfg codegenapi.Config) string
- func (f *Field) TsBuilderUnionType(cfg codegenapi.Config) string
- func (f *Field) TsFieldName(cfg codegenapi.Config) string
- func (f *Field) TsFieldType(cfg codegenapi.Config) string
- func (f *Field) TsType() string
- func (f *Field) Unique() bool
- type FieldInfo
- func (fieldInfo *FieldInfo) AddComputedField(f string) error
- func (fieldInfo *FieldInfo) AllFields() []*Field
- func (fieldInfo *FieldInfo) EntFields() []*Field
- func (fieldInfo *FieldInfo) GetEditableFieldsInBuilder() []*Field
- func (fieldInfo *FieldInfo) GetFieldByColName(col string) *Field
- func (fieldInfo *FieldInfo) GetFieldByName(fieldName string) *Field
- func (fieldInfo *FieldInfo) GetImmutableFields() []*Field
- func (fieldInfo *FieldInfo) GraphQLFields() []*Field
- func (fieldInfo *FieldInfo) InvalidateFieldForGraphQL(f *Field) error
- func (fieldInfo *FieldInfo) IsComputedField(f string) bool
- func (fieldInfo *FieldInfo) NotEditableInverseEdgeFieldsWithDefaults() []*Field
- func (fieldInfo *FieldInfo) SingleFieldPrimaryKey() string
- type ForeignKeyInfo
- type NonEntField
- func (f *NonEntField) DefaultValue() *string
- func (f *NonEntField) ExposeToGraphQL() bool
- func (f *NonEntField) ForceOptionalInAction() bool
- func (f *NonEntField) ForceRequiredInAction() bool
- func (f *NonEntField) GetFieldName() string
- func (f *NonEntField) GetFieldType() enttype.Type
- func (f *NonEntField) GetGraphQLFieldType() enttype.TSType
- func (f *NonEntField) GetGraphQLMutationFieldType(forceOptional bool) enttype.TSType
- func (f *NonEntField) GetGraphQLName() string
- func (f *NonEntField) GetTSGraphQLTypeForFieldImports(input bool) []*tsimport.ImportPath
- func (f *NonEntField) GetTsType() string
- func (f *NonEntField) GetTsTypeImports() []*tsimport.ImportPath
- func (f *NonEntField) HasDefaultValueOnCreate() bool
- func (f *NonEntField) IsEditableIDField(ctx EditableContext) bool
- func (f *NonEntField) Nullable() bool
- func (f *NonEntField) Optional() bool
- func (f *NonEntField) Required() bool
- func (f *NonEntField) SetFlag(flag string) *NonEntField
- func (f *NonEntField) SetNodeType(nodeType string) *NonEntField
- func (f *NonEntField) SetOptional(optional bool) *NonEntField
- func (f *NonEntField) SingleFieldPrimaryKey() bool
- func (f *NonEntField) TSPublicAPIName() string
- func (f *NonEntField) TsBuilderFieldName() string
- func (f *NonEntField) TsBuilderType(cfg codegenapi.Config) string
- func (f *NonEntField) TsFieldName(cfg codegenapi.Config) string
- type Option
- type Options
Constants ¶
const BuilderEditableContext = "builder"
const CreateEditableContext = "create"
const DeleteEditableContext = "delete"
const EditEditableContext = "edit"
Variables ¶
This section is empty.
Functions ¶
func CompareFieldInfo ¶ added in v0.0.38
func CompareNonEntField ¶ added in v0.0.38
func CompareNonEntField(existing, field *NonEntField) []change.Change
func FieldEqual ¶ added in v0.0.38
func FieldsEqual ¶ added in v0.0.38
func NonEntFieldEqual ¶ added in v0.0.38
func NonEntFieldEqual(existing, field *NonEntField) bool
func NonEntFieldsEqual ¶ added in v0.0.38
func NonEntFieldsEqual(existing, fields []*NonEntField) bool
func NormalizedField ¶
Types ¶
type CustomInterfaceGetter ¶ added in v0.1.0
type CustomInterfaceGetter interface {
GetCustomTypeByTSName(name string) CustomTypeWithHasConvertFunction
}
type CustomTypeWithHasConvertFunction ¶ added in v0.1.0
type CustomTypeWithHasConvertFunction interface {
HasConvertFunction(cfg codegenapi.Config) bool
}
type EditableContext ¶ added in v0.1.0
type EditableContext string
type Field ¶
type Field struct { // note that if this changes, need to update FieldEqual // todo: abstract out these 2 also... FieldName string // contains filtered or unexported fields }
func NewFieldFromNameAndType ¶ added in v0.0.38
mostly used by tests
func (*Field) AddFieldEdgeToEdgeInfo ¶
func (*Field) AddForeignKeyEdgeToInverseEdgeInfo ¶
func (*Field) AddForeignKeyFieldEdgeToEdgeInfo ¶
func (f *Field) AddForeignKeyFieldEdgeToEdgeInfo( cfg codegenapi.Config, edgeInfo *edge.EdgeInfo, validSchema func(str string) bool, ) error
We're going from field -> edge to be consistent and not have circular dependencies
func (*Field) AddInverseEdge ¶
func (f *Field) AddInverseEdge(cfg codegenapi.Config, edge *edge.AssociationEdge) error
func (*Field) CamelCaseName ¶
func (*Field) CreateDBColumn ¶
func (*Field) DefaultToViewerOnCreate ¶ added in v0.1.0
func (*Field) DefaultValue ¶
func (*Field) EditableField ¶
func (f *Field) EditableField(ctx EditableContext) bool
create, delete, edit, builder TODO change everything to use this..
func (*Field) EditableGraphQLField ¶ added in v0.0.38
func (*Field) EmbeddableInParentAction ¶
func (*Field) EvolvedIDField ¶
func (*Field) ExposeFieldOrFieldEdgeToGraphQL ¶ added in v0.1.0
func (*Field) ExposeToActionsByDefault ¶
func (*Field) ExposeToGraphQL ¶
func (*Field) FetchOnDemand ¶ added in v0.1.0
func (*Field) FetchOnLoad ¶ added in v0.1.0
func (*Field) FieldEdgeInfo ¶
func (f *Field) FieldEdgeInfo() *base.FieldEdgeInfo
func (*Field) ForceOptionalInAction ¶
func (*Field) ForceRequiredInAction ¶
func (*Field) ForeignKeyInfo ¶
func (f *Field) ForeignKeyInfo() *ForeignKeyInfo
func (*Field) GetConvertImport ¶ added in v0.1.0
func (f *Field) GetConvertImport(cfg codegenapi.Config, g CustomInterfaceGetter) *tsimport.ImportPath
func (*Field) GetConvertMethod ¶ added in v0.1.0
func (f *Field) GetConvertMethod(cfg codegenapi.Config) string
func (*Field) GetDbColName ¶
func (*Field) GetDbTypeForField ¶
func (*Field) GetFieldNameInStruct ¶
GetFieldNameInStruct returns the name of the field in the struct definition with capital letter for public fields. lowercase letter for package-private
func (*Field) GetFieldType ¶
func (*Field) GetGraphQLName ¶
func (*Field) GetGraphQLTypeForField ¶
func (*Field) GetImmutableOverrideFieldNameInBuilder ¶ added in v0.1.0
func (*Field) GetImportsForTypes ¶ added in v0.1.0
func (f *Field) GetImportsForTypes(cfg codegenapi.Config, g CustomInterfaceGetter, s enttype.SchemaType) []*tsimport.ImportPath
func (*Field) GetInverseEdge ¶
func (f *Field) GetInverseEdge() *edge.AssociationEdge
func (*Field) GetNotNullableTsType ¶
func (*Field) GetPatternName ¶ added in v0.0.37
func (*Field) GetPossibleTypes ¶ added in v0.1.0
func (*Field) GetQuotedDBColName ¶
func (*Field) GetTSFieldType ¶ added in v0.1.0
func (f *Field) GetTSFieldType(cfg codegenapi.Config) enttype.Type
should mirror TsFieldType because it's used to determine if nullable and if convertFunc
func (*Field) GetTSGraphQLTypeForFieldImports ¶
func (f *Field) GetTSGraphQLTypeForFieldImports(input bool) []*tsimport.ImportPath
func (*Field) GetTSMutationGraphQLTypeForFieldImports ¶ added in v0.1.0
func (f *Field) GetTSMutationGraphQLTypeForFieldImports(forceOptional, input bool) []*tsimport.ImportPath
for non-required fields in actions, we want to make it optional if it's not a required field in the action in mutations, we ignore any graphql specific nature of the field and use underlying API TODO multiple booleans is a horrible code-smell. fix with options or something
func (*Field) GetTsTypeImports ¶ added in v0.0.38
func (f *Field) GetTsTypeImports() []*tsimport.ImportPath
func (*Field) GetUserConvert ¶ added in v0.1.0
func (f *Field) GetUserConvert() *input.UserConvertType
func (*Field) HasAsyncAccessor ¶ added in v0.1.0
func (f *Field) HasAsyncAccessor(cfg codegenapi.Config) bool
func (*Field) HasConvertFunction ¶ added in v0.1.0
func (f *Field) HasConvertFunction(cfg codegenapi.Config, g CustomInterfaceGetter) bool
func (*Field) HasDefaultValueOnCreate ¶
func (*Field) HasDefaultValueOnEdit ¶
func (*Field) HasEditFieldPrivacy ¶ added in v0.1.0
func (*Field) HasFieldPrivacy ¶ added in v0.1.0
func (*Field) InstanceFieldName ¶
func (*Field) IsEditableIDField ¶
func (f *Field) IsEditableIDField(ctx EditableContext) bool
func (*Field) PatternField ¶ added in v0.0.37
func (*Field) QueryFromEnt ¶ added in v0.0.32
func (*Field) QueryFromEntName ¶ added in v0.0.32
func (*Field) SingleFieldPrimaryKey ¶
func (*Field) TSBuilderWithRelativeType ¶ added in v0.1.0
func (f *Field) TSBuilderWithRelativeType(cfg codegenapi.Config) string
this assumes it's ok to do relative. up to caller to confirm that it is before calling
func (*Field) TSPublicAPIName ¶ added in v0.1.0
either async function name or public field
func (*Field) TsActualType ¶ added in v0.1.0
return type with no shenanigans
func (*Field) TsBuilderFieldName ¶ added in v0.1.0
func (*Field) TsBuilderImports ¶
func (f *Field) TsBuilderImports(cfg codegenapi.Config) []*tsimport.ImportPath
func (*Field) TsBuilderType ¶
func (f *Field) TsBuilderType(cfg codegenapi.Config) string
func (*Field) TsBuilderUnionType ¶ added in v0.1.0
func (f *Field) TsBuilderUnionType(cfg codegenapi.Config) string
for getFooValue() where there's a nullable type but the input type isn't nullable because the underlying db value isn't
func (*Field) TsFieldName ¶
func (f *Field) TsFieldName(cfg codegenapi.Config) string
func (*Field) TsFieldType ¶ added in v0.1.0
func (f *Field) TsFieldType(cfg codegenapi.Config) string
type of the field in the class e.g. readonly name type;
type FieldInfo ¶
type FieldInfo struct { // really only used in tests and old go schema NonEntFields []*NonEntField // contains filtered or unexported fields }
func NewFieldInfoFromInputs ¶
func (*FieldInfo) AddComputedField ¶ added in v0.0.39
func (*FieldInfo) GetEditableFieldsInBuilder ¶ added in v0.1.0
need a difference btw builder fields, create-only fields etc basically need to special case create and add it in creation and then overrideFoo(val) etc...
func (*FieldInfo) GetFieldByColName ¶
func (*FieldInfo) GetFieldByName ¶
func (*FieldInfo) GetImmutableFields ¶ added in v0.1.0
func (*FieldInfo) GraphQLFields ¶
func (*FieldInfo) InvalidateFieldForGraphQL ¶
func (*FieldInfo) IsComputedField ¶ added in v0.0.39
func (*FieldInfo) NotEditableInverseEdgeFieldsWithDefaults ¶ added in v0.1.0
should be only used in builder
func (*FieldInfo) SingleFieldPrimaryKey ¶ added in v0.1.0
type ForeignKeyInfo ¶
type ForeignKeyInfo struct { // Note that changing this should update foreignKeyInfoEqual Schema string Field string Name string DisableIndex bool }
ForeignKeyInfo stores config and field name of the foreign key object
type NonEntField ¶
type NonEntField struct { // TODO these are both go things. ignore // Flag enum or ID Flag string // this is a go-thing. ignore for TypeScript NodeType string // contains filtered or unexported fields }
func NewNonEntField ¶ added in v0.0.37
func NewNonEntField(cfg codegenapi.Config, fieldName string, fieldType enttype.TSType, nullable, hideFromGraphQL bool) *NonEntField
func (*NonEntField) DefaultValue ¶ added in v0.0.37
func (f *NonEntField) DefaultValue() *string
func (*NonEntField) ExposeToGraphQL ¶ added in v0.1.0
func (f *NonEntField) ExposeToGraphQL() bool
func (*NonEntField) ForceOptionalInAction ¶ added in v0.0.37
func (f *NonEntField) ForceOptionalInAction() bool
func (*NonEntField) ForceRequiredInAction ¶ added in v0.0.37
func (f *NonEntField) ForceRequiredInAction() bool
func (*NonEntField) GetFieldName ¶ added in v0.0.39
func (f *NonEntField) GetFieldName() string
func (*NonEntField) GetFieldType ¶ added in v0.0.37
func (f *NonEntField) GetFieldType() enttype.Type
func (*NonEntField) GetGraphQLFieldType ¶ added in v0.0.39
func (f *NonEntField) GetGraphQLFieldType() enttype.TSType
func (*NonEntField) GetGraphQLMutationFieldType ¶ added in v0.1.0
func (f *NonEntField) GetGraphQLMutationFieldType(forceOptional bool) enttype.TSType
func (*NonEntField) GetGraphQLName ¶
func (f *NonEntField) GetGraphQLName() string
func (*NonEntField) GetTSGraphQLTypeForFieldImports ¶ added in v0.1.0
func (f *NonEntField) GetTSGraphQLTypeForFieldImports(input bool) []*tsimport.ImportPath
func (*NonEntField) GetTsType ¶ added in v0.0.37
func (f *NonEntField) GetTsType() string
don't have to deal with all the id field stuff field.Field has to deal with
func (*NonEntField) GetTsTypeImports ¶ added in v0.0.39
func (f *NonEntField) GetTsTypeImports() []*tsimport.ImportPath
func (*NonEntField) HasDefaultValueOnCreate ¶ added in v0.0.37
func (f *NonEntField) HasDefaultValueOnCreate() bool
func (*NonEntField) IsEditableIDField ¶ added in v0.0.39
func (f *NonEntField) IsEditableIDField(ctx EditableContext) bool
func (*NonEntField) Nullable ¶ added in v0.0.37
func (f *NonEntField) Nullable() bool
func (*NonEntField) Optional ¶ added in v0.1.0
func (f *NonEntField) Optional() bool
func (*NonEntField) Required ¶ added in v0.0.37
func (f *NonEntField) Required() bool
func (*NonEntField) SetFlag ¶ added in v0.0.39
func (f *NonEntField) SetFlag(flag string) *NonEntField
func (*NonEntField) SetNodeType ¶ added in v0.0.39
func (f *NonEntField) SetNodeType(nodeType string) *NonEntField
func (*NonEntField) SetOptional ¶ added in v0.1.0
func (f *NonEntField) SetOptional(optional bool) *NonEntField
func (*NonEntField) SingleFieldPrimaryKey ¶ added in v0.1.13
func (f *NonEntField) SingleFieldPrimaryKey() bool
func (*NonEntField) TSPublicAPIName ¶ added in v0.1.0
func (f *NonEntField) TSPublicAPIName() string
func (*NonEntField) TsBuilderFieldName ¶ added in v0.1.0
func (f *NonEntField) TsBuilderFieldName() string
func (*NonEntField) TsBuilderType ¶ added in v0.1.0
func (f *NonEntField) TsBuilderType(cfg codegenapi.Config) string
func (*NonEntField) TsFieldName ¶ added in v0.0.37
func (f *NonEntField) TsFieldName(cfg codegenapi.Config) string