gen

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const BackQuote = "`"
View Source
const EntityTemplate = `` /* 264-byte string literal not displayed */
View Source
const TableTemplate = `` /* 2007-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 Options

type Options struct {
	PackageName   string
	EntityPackage string
	TablePackage  string
}

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, options Options) (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
	EntitiesName     string
	Fields           []EntityField
	Keys             []EntityKey
	BackQuote        string
	EntityPackage    string
	TablePackage     string
	SecondaryIndexes []SecondaryIndex
}

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
}

Jump to

Keyboard shortcuts

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