schema

package
v0.0.0-...-f8fad95 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TimestampType = ".google.protobuf.Timestamp"
)

Variables

This section is empty.

Functions

func ParseInput

func ParseInput(in io.Reader) (*pluginpb.CodeGeneratorRequest, error)

func ProcessDDL

func ProcessDDL(req *pluginpb.CodeGeneratorRequest) (DDLOption, *Messages)

func ToCamel

func ToCamel(str string) string

func ToLowerCamel

func ToLowerCamel(str string) string

func ToSnake

func ToSnake(str string) string

Types

type DDLOption

type DDLOption struct {
	Dialect    string
	OutputFile string
}

type EntityOption

type EntityOption struct {
	Lang       string
	DAOPath    string
	OutputFile string
}

type Enum

type Enum struct {
	Descriptor *descriptorpb.EnumDescriptorProto
	Package    string
	FullName   string
	Values     []*EnumValue
}

type EnumValue

type EnumValue struct {
	Name  string
	Value int32
}

type Field

type Field struct {
	Descriptor   *descriptorpb.FieldDescriptorProto
	Ext          *ddl.ColumnOptions
	Name         string
	Type         string
	OriginalType string
	OptionalType string
	Size         int
	Null         bool
	Sequence     bool
	Default      string

	Deprecated bool
	Comment    string

	Virtual bool
}

func (*Field) Copy

func (f *Field) Copy() *Field

func (*Field) IsPrimitiveType

func (f *Field) IsPrimitiveType() bool

func (*Field) Reference

func (f *Field) Reference() *Field

func (*Field) String

func (f *Field) String() string

type Fields

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

func NewFields

func NewFields(fields []*Field) *Fields

func (*Fields) Each

func (f *Fields) Each(fn func(f *Field))

func (*Fields) Get

func (f *Fields) Get(name string) *Field

func (*Fields) Len

func (f *Fields) Len() int

func (*Fields) List

func (f *Fields) List() []*Field

func (*Fields) Replace

func (f *Fields) Replace(oldName string, newField ...*Field)

func (*Fields) String

func (f *Fields) String() string

type Index

type Index struct {
	Name    string
	Columns *Fields
	Unique  bool
}

type Message

type Message struct {
	Descriptor    *descriptorpb.DescriptorProto
	Package       string
	FullName      string
	TableName     string
	Fields        *Fields
	PrimaryKeys   []*Field
	Indexes       []*Index
	Relations     Relations
	Engine        string
	WithTimestamp bool
	Deprecated    bool
	Comment       string

	SelectQueries []*Query
	// contains filtered or unexported fields
}

func (*Message) IsPrimaryKey

func (m *Message) IsPrimaryKey(f *Field) bool

func (*Message) IsReturningSingleRow

func (m *Message) IsReturningSingleRow(fields ...*Field) bool

func (*Message) String

func (m *Message) String() string

type Messages

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

func NewMessages

func NewMessages(messages []*Message, enums []*Enum) *Messages

func (*Messages) Denormalize

func (m *Messages) Denormalize()

func (*Messages) Each

func (m *Messages) Each(fn func(m *Message))

func (*Messages) EachEnum

func (m *Messages) EachEnum(fn func(e *Enum))

func (*Messages) FindByDescriptor

func (m *Messages) FindByDescriptor(d *descriptorpb.DescriptorProto) *Message

func (*Messages) FindEnum

func (m *Messages) FindEnum(fullName string) *Enum

func (*Messages) String

func (m *Messages) String() string

type Query

type Query struct {
	Name  string
	Query string
}

type Relations

type Relations map[*Field][]*Field

func (Relations) Replace

func (r Relations) Replace(old *Field, newFields ...*Field)

Jump to

Keyboard shortcuts

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