gen

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const BackQuote = "`"
View Source
const EntityTemplate = `` /* 774-byte string literal not displayed */
View Source
const TableTemplate = `` /* 2306-byte string literal not displayed */

Variables

This section is empty.

Functions

This section is empty.

Types

type EntityField

type EntityField struct {
	Name       string
	Type       string
	JsonKey    string
	ColumnName string
	BackQuote  string
}

type EntityKey

type EntityKey struct {
	ColumnName string
	Type       string
	FieldName  string
	BackQuote  string
}

type FileSource

type FileSource struct {
	Path string
}

func (FileSource) GetSchemas

func (src FileSource) GetSchemas(ctx context.Context) ([]migrate.Schema, error)

type GenerateOption added in v0.1.12

type GenerateOption func(o *Options)

func WithBinaryMarshaller added in v0.1.12

func WithBinaryMarshaller() GenerateOption

func WithEntityPackage added in v0.1.12

func WithEntityPackage(name string) GenerateOption

func WithPackageName added in v0.1.12

func WithPackageName(name string) GenerateOption

func WithTableNamePrefix added in v0.1.12

func WithTableNamePrefix(prefix string) GenerateOption

func WithTablePackage added in v0.1.12

func WithTablePackage(name string) GenerateOption

type Options

type Options struct {
	PackageName      string
	EntityPackage    string
	TablePackage     string
	TableNamePrefix  string
	BinaryMarshaller bool
}

type Output

type Output struct {
	Name string

	Entity string

	Table string
	// contains filtered or unexported fields
}

func (Output) WriteFile

func (out Output) WriteFile(ctx context.Context, path string) error

type Outputs

type Outputs []Output

func Generate

func Generate(ctx context.Context, src SchemaSource, opt ...GenerateOption) (Outputs, error)

func (Outputs) WriteFile

func (out Outputs) WriteFile(ctx context.Context, path string) error

type Param

type Param struct {
	PackageName      string
	EntityName       string
	TableName        string
	TableFullName    string
	EntitiesName     string
	Fields           []EntityField
	Keys             []EntityKey
	BackQuote        string
	EntityPackage    string
	TablePackage     string
	SecondaryIndexes []SecondaryIndex
	Receiver         string
	BinaryMarshaller bool
	TimeToLive       *TimeToLive
}

type SchemaSource

type SchemaSource interface {
	GetSchemas(ctx context.Context) ([]migrate.Schema, error)
}

type SchemasSource

type SchemasSource struct {
	Schemas []migrate.Schema
}

func (SchemasSource) GetSchemas

func (src SchemasSource) GetSchemas(ctx context.Context) ([]migrate.Schema, error)

type SecondaryIndex

type SecondaryIndex struct {
	Name      string
	TableName string
	IndexName string
	Keys      []EntityKey
}

type TimeToLive added in v0.1.12

type TimeToLive struct {
	Name       string
	JsonKey    string
	ColumnName string
}

Jump to

Keyboard shortcuts

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