transformers

package
v4.12.4 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: MPL-2.0 Imports: 11 Imported by: 237

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(tables schema.Tables, extraTransformers ...schema.Transform) error

Apply applies the given transformers to the given Tables, and recursively on the relations. This is useful for applying transformers that are not defined in the table definitions. To apply the table-definition transformers, use TransformTables.

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) (arrow.DataType, error)

func SetParents

func SetParents(tables schema.Tables, parent *schema.Table)

Set parent links on relational tables

func TransformTables

func TransformTables(tables schema.Tables) error

TransformTables runs given Tables' transformers as defined in the table definitions, and recursively on the relations. To apply additional transformers, use Apply.

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) (arrow.DataType, error)

Jump to

Keyboard shortcuts

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