Documentation ¶
Index ¶
- type Column
- type Enum
- type EnumCollection
- type EnumField
- type Message
- func (m *Message) AppendField(mf MessageField) error
- func (m Message) GenDefaultMessage(buf *bytes.Buffer)
- func (m Message) GenRpcAddReqRespMessage(buf *bytes.Buffer)
- func (m Message) GenRpcDelReqMessage(buf *bytes.Buffer)
- func (m Message) GenRpcGetByIdReqMessage(buf *bytes.Buffer)
- func (m Message) GenRpcSearchReqMessage(buf *bytes.Buffer)
- func (m Message) GenRpcUpdateReqMessage(buf *bytes.Buffer)
- func (m Message) String() string
- type MessageCollection
- type MessageField
- type Schema
- type Service
- type Table
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 }
Column represents a database column.
type Enum ¶
Enum represents a protocol buffer enumerated type.
func (*Enum) AppendField ¶
AppendField appends an EnumField to an Enum.
type EnumCollection ¶
type EnumCollection []*Enum
EnumCollection represents a sortable collection of enums.
func (EnumCollection) Len ¶
func (ec EnumCollection) Len() int
func (EnumCollection) Less ¶
func (ec EnumCollection) Less(i, j int) bool
func (EnumCollection) Swap ¶
func (ec EnumCollection) Swap(i, j int)
type EnumField ¶
type EnumField struct {
// contains filtered or unexported fields
}
EnumField represents a field in an enumerated type.
func NewEnumField ¶
NewEnumField constructs an EnumField type.
type Message ¶
type Message struct { Name string Comment string Fields []MessageField Style string }
Message represents a protocol buffer message.
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) GenDefaultMessage ¶
GenDefaultMessage gen default message
func (Message) GenRpcAddReqRespMessage ¶
GenRpcAddReqRespMessage gen add req message
func (Message) GenRpcDelReqMessage ¶
GenRpcDelReqMessage gen add resp message
func (Message) GenRpcGetByIdReqMessage ¶
GenRpcGetByIdReqMessage gen add resp message
func (Message) GenRpcSearchReqMessage ¶
GenRpcSearchReqMessage gen add resp message
func (Message) GenRpcUpdateReqMessage ¶
GenRpcUpdateReqMessage gen add resp message
type MessageCollection ¶
type MessageCollection []*Message
MessageCollection represents a sortable collection of messages.
func (MessageCollection) Len ¶
func (mc MessageCollection) Len() int
func (MessageCollection) Less ¶
func (mc MessageCollection) Less(i, j int) bool
func (MessageCollection) Swap ¶
func (mc MessageCollection) Swap(i, j int)
type MessageField ¶
type MessageField struct { Typ string Name string Comment string // contains filtered or unexported fields }
MessageField represents the field of a message.
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 MessageCollection Enums EnumCollection }
Schema is a representation of a protobuf schema.
func GenerateSchema ¶
func GenerateSchema(db *sql.DB, table string, ignoreTables, ignoreColumns []string, serviceName, goPkg, pkg, fieldStyle string) (*Schema, error)
GenerateSchema generates a protobuf schema from a database connection and a package name. A list of tables to ignore may also be supplied. The returned schema implements the `fmt.Stringer` interface, in order to generate a string representation of a protobuf schema. Do not rely on the structure of the Generated schema to provide any context about the protobuf types. The schema reflects the layout of a protobuf file and should be used to pipe the output of the `Schema.String()` to a file.
func (*Schema) AppendImport ¶
AppendImport adds an import to a schema if the specific import does not already exist in the schema.