transformers

package
v2.7.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: MPL-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultIgnoreInTestsTransformer

func DefaultIgnoreInTestsTransformer(_ reflect.StructField) bool

func DefaultNameTransformer

func DefaultNameTransformer(field reflect.StructField) (string, error)

func DefaultResolverTransformer

func DefaultResolverTransformer(_ reflect.StructField, path string) schema.ColumnResolver

func DefaultTypeTransformer

func DefaultTypeTransformer(v reflect.StructField) (schema.ValueType, error)

func TransformWithStruct

func TransformWithStruct(st any, opts ...StructTransformerOption) schema.Transform

Types

type IgnoreInTestsTransformer

type IgnoreInTestsTransformer func(field reflect.StructField) bool

type NameTransformer

type NameTransformer func(reflect.StructField) (string, error)

type ResolverTransformer

type ResolverTransformer func(field reflect.StructField, path string) schema.ColumnResolver

type StructTransformerOption

type StructTransformerOption func(*structTransformer)

func WithIgnoreInTestsTransformer

func WithIgnoreInTestsTransformer(transformer IgnoreInTestsTransformer) StructTransformerOption

WithIgnoreInTestsTransformer overrides how column ignoreInTests will be determined. DefaultIgnoreInTestsTransformer is used as the default.

func WithNameTransformer

func WithNameTransformer(transformer NameTransformer) StructTransformerOption

WithNameTransformer overrides how column name will be determined. DefaultNameTransformer is used as the default.

func WithPrimaryKeys

func WithPrimaryKeys(fields ...string) StructTransformerOption

WithPrimaryKeys allows to specify what struct fields should be used as primary keys

func WithResolverTransformer

func WithResolverTransformer(transformer ResolverTransformer) StructTransformerOption

WithResolverTransformer overrides how column resolver will be determined. DefaultResolverTransformer is used as the default.

func WithSkipFields

func WithSkipFields(fields ...string) StructTransformerOption

WithSkipFields allows to specify what struct fields should be skipped.

func WithTypeTransformer

func WithTypeTransformer(transformer TypeTransformer) StructTransformerOption

WithTypeTransformer overrides how column type will be determined. DefaultTypeTransformer is used as the default.

func WithUnwrapAllEmbeddedStructs

func WithUnwrapAllEmbeddedStructs() StructTransformerOption

WithUnwrapAllEmbeddedStructs instructs codegen to unwrap all embedded fields (1 level deep only)

func WithUnwrapStructFields

func WithUnwrapStructFields(fields ...string) StructTransformerOption

WithUnwrapStructFields allows to unwrap specific struct fields (1 level deep only)

type TypeTransformer

type TypeTransformer func(reflect.StructField) (schema.ValueType, error)

Jump to

Keyboard shortcuts

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