parser

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	Style                  string
	TableName              string
	TableComment           string
	ColumnName             string
	IsNullable             string
	DataType               string
	CharacterMaximumLength sql.NullInt64
	NumericPrecision       sql.NullInt64
	NumericScale           sql.NullInt64
	ColumnType             string
	ColumnComment          string
}

type Enum

type Enum struct {
	Name    string
	Comment string
	Fields  []EnumField
}

Enum represents a protocol buffer enumerated type.

func (*Enum) AppendField

func (e *Enum) AppendField(ef EnumField) error

AppendField appends an EnumField to an Enum.

func (*Enum) String

func (e *Enum) String() string

String returns a string representation of an Enum.

type EnumField

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

EnumField represents a field in an enumerated type.

func NewEnumField

func NewEnumField(name string, tag int) EnumField

NewEnumField constructs an EnumField type.

func (EnumField) Name

func (ef EnumField) Name() string

Name returns the name of the enum field.

func (EnumField) String

func (ef EnumField) String() string

String returns a string representation of an Enum.

func (EnumField) Tag

func (ef EnumField) Tag() int

Tag returns the identifier tag of the enum field.

type Message

type Message struct {
	Name    string
	Comment string
	Fields  []MessageField
	Style   string
}

func (*Message) AppendField

func (m *Message) AppendField(mf MessageField) error

AppendField appends a message field to a message. If the tag of the message field is in use, an error will be returned.

func (*Message) GenDefaultFilterMessage

func (m *Message) GenDefaultFilterMessage(buf *bytes.Buffer)

func (*Message) GenDefaultMessage

func (m *Message) GenDefaultMessage(buf *bytes.Buffer)

GenDefaultMessage gen default message

func (*Message) GenRpcAddReqRespMessage

func (m *Message) GenRpcAddReqRespMessage(buf *bytes.Buffer)

GenRpcAddReqRespMessage gen add req message

func (*Message) GenRpcDelReqMessage

func (m *Message) GenRpcDelReqMessage(buf *bytes.Buffer)

GenRpcDelReqMessage gen add resp message

func (*Message) GenRpcGetByIdReqMessage

func (m *Message) GenRpcGetByIdReqMessage(buf *bytes.Buffer)

GenRpcGetByIdReqMessage gen add resp message

func (*Message) GenRpcSearchReqMessage

func (m *Message) GenRpcSearchReqMessage(buf *bytes.Buffer)

GenRpcSearchReqMessage gen add resp message

func (*Message) GenRpcUpdateReqMessage

func (m *Message) GenRpcUpdateReqMessage(buf *bytes.Buffer)

GenRpcUpdateReqMessage gen add resp message

func (*Message) String

func (m *Message) String() string

String returns a string representation of a Message.

type MessageField

type MessageField struct {
	Typ  string
	Name string

	Comment string
	// contains filtered or unexported fields
}

func NewMessageField

func NewMessageField(typ, name string, tag int, comment string) MessageField

NewMessageField creates a new message field.

func (MessageField) String

func (f MessageField) String() string

String returns a string representation of a message field.

func (MessageField) Tag

func (f MessageField) Tag() int

Tag returns the unique numbered tag of the message field.

type Schema

type Schema struct {
	Syntax      string
	ServiceName string
	GoPackage   string
	Package     string
	Imports     sort.StringSlice
	Messages    []*Message
	Enums       []*Enum
}

func NewSchema

func NewSchema(syntax string, serviceName string, goPackage string, Package string) *Schema

func (*Schema) String

func (s *Schema) String() string

String returns a string representation of a Schema.

func (*Schema) TypesFromColumns

func (s *Schema) TypesFromColumns(cols []Column, ignoreTables, ignoreColumns []string, fieldStyle string) error

TypesFromColumns creates the appropriate schema properties from a collection of column types.

Jump to

Keyboard shortcuts

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