schema

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ref

func Ref(f FieldType) ref

func Slice

func Slice(f FieldType) slice

Types

type Association

type Association struct {
	Slice  bool
	Schema Schema
}

type Elementer

type Elementer interface {
	Element() FieldType
}

type Field

type Field struct {
	Name    string
	Type    FieldType
	Tag     string
	Options FieldOptions
}

func (Field) ColumnName

func (f Field) ColumnName() string

func (Field) IsAssociation

func (f Field) IsAssociation() bool

func (Field) IsImmutable

func (f Field) IsImmutable() bool

func (Field) IsMutable

func (f Field) IsMutable() bool

func (Field) String

func (f Field) String() string

type FieldOptions

type FieldOptions struct {
	Immutable   bool
	PrimaryKey  bool
	Ignore      bool // ignore fields for insert and update like fields of association.
	Association *Association
	Validators  []Validator
}

type FieldType

type FieldType fmt.Stringer

type FieldValueType

type FieldValueType string
const (
	String FieldValueType = "string"
	Int    FieldValueType = "int"
	Bool   FieldValueType = "bool"
	Byte   FieldValueType = "byte"
	Time   FieldValueType = "time.Time"
	UUID   FieldValueType = "uuid.UUID"
)

func (FieldValueType) String

func (f FieldValueType) String() string

type Schema

type Schema struct {
	Name      string
	TableName string
	Fields    []Field
}

func (*Schema) AddFields

func (s *Schema) AddFields(fields ...Field)

func (*Schema) AssociationFields

func (s *Schema) AssociationFields() []Field

func (*Schema) ColumnFields

func (s *Schema) ColumnFields() []Field

func (*Schema) Columns

func (s *Schema) Columns() []string

func (*Schema) FieldNames

func (s *Schema) FieldNames() []string

func (*Schema) IgnoredFields

func (s *Schema) IgnoredFields() []Field

func (*Schema) ImmutableColumns

func (s *Schema) ImmutableColumns() []string

func (*Schema) ImmutablePlaceholders

func (s *Schema) ImmutablePlaceholders() []string

func (*Schema) MutableColumns

func (s *Schema) MutableColumns() []string

func (*Schema) MutableFieldKeys

func (s *Schema) MutableFieldKeys() []string

func (*Schema) MutableFields

func (s *Schema) MutableFields() []Field

func (*Schema) MutablePlaceholders

func (s *Schema) MutablePlaceholders() []string

func (*Schema) PrimaryKey

func (s *Schema) PrimaryKey() string

func (*Schema) SetClause

func (s *Schema) SetClause() []string

func (*Schema) Type

func (s *Schema) Type() SchemaType

type SchemaCollection

type SchemaCollection struct {
	URL     string
	Dir     string
	Package string
	Schemas []Schema
}

func (SchemaCollection) Filename

func (s SchemaCollection) Filename() string

func (SchemaCollection) Gen

func (s SchemaCollection) Gen() error

func (SchemaCollection) PackageURL

func (s SchemaCollection) PackageURL() string

func (SchemaCollection) Render

func (s SchemaCollection) Render() (string, error)

type SchemaFactory

type SchemaFactory struct {
	Primary       Field
	DefaultFields []Field
}

func (SchemaFactory) NewSchema

func (d SchemaFactory) NewSchema(fields []Field) *Schema

type SchemaTemplate

type SchemaTemplate struct {
	URL     string
	Package string
	Schema  Schema
	// contains filtered or unexported fields
}

func (SchemaTemplate) Filename

func (s SchemaTemplate) Filename() string

func (SchemaTemplate) Render

func (s SchemaTemplate) Render() (string, error)

type SchemaType

type SchemaType struct {
	// contains filtered or unexported fields
}

func (SchemaType) String

func (s SchemaType) String() string

type Validator

type Validator struct {
	Fields   []string
	Validate validator.Validator
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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