ddl

package
v0.0.0-...-5c77a2f Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorDatastoreUnspecified = fmt.Errorf("datastore unspecified")
	ErrNotSupportedDatastore  = fmt.Errorf("not supported datastore")
)

Functions

func GenerateDDLFiles

func GenerateDDLFiles(version string, gen *protogen.Plugin) error

Types

type Field

type Field struct {
	Options []FieldOption

	TextName  string
	GoName    string
	VarName   string
	SQLName   string
	ParamName string

	PbKind        string
	PbType        string
	SQLType       string
	GoType        string
	GoValueType   string
	GoTypeVarName string

	SupportsSQLNullType bool
	IsWellKnownType     bool
	IsRepeatedType      bool
	IsEnumType          bool
	// contains filtered or unexported fields
}

func NewField

func NewField(field protogen.Field) (*Field, error)

func (Field) ToDDLSQL

func (f Field) ToDDLSQL() string

type FieldOption

type FieldOption struct {
	Name  string
	Value string
}

type Index

type Index struct {
	Name   string
	Fields []Field
}

type MessageInfo

type MessageInfo struct {
	MessageOptions []MessageOption
	NestedMessages []*MessageInfo

	Name    string
	VarName string
	GoName  string
	SQLName string

	Fields    []Field
	KeyFields []Field
	Indices   []Index
	Uniques   []Unique
	// contains filtered or unexported fields
}

func NewMessageInfo

func NewMessageInfo(message protogen.Message) (*MessageInfo, error)

func (MessageInfo) DDLFileSuffix

func (mi MessageInfo) DDLFileSuffix() (string, error)

DDLFileSuffix returns the suffix of ddl file.

func (MessageInfo) DMLFileSuffix

func (mi MessageInfo) DMLFileSuffix() (string, error)

DMLFileSuffix returns file suffix for dml file.

func (MessageInfo) DMLMockFileSuffix

func (mi MessageInfo) DMLMockFileSuffix() (string, error)

DMLMockFileSuffix returns file suffix for dml mock file.

func (MessageInfo) GenerateDDL

func (mi MessageInfo) GenerateDDL() (string, error)

func (MessageInfo) GenerateDML

func (mi MessageInfo) GenerateDML(goFilename string, mockFilename string) (string, error)

type MessageOption

type MessageOption struct {
	Name  string
	Value string
}

type Unique

type Unique struct {
	Name   string
	Fields []Field
}

Jump to

Keyboard shortcuts

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