proto

package
v1.0.0-rc1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CodeGen

type CodeGen struct {
	Messages                  []*Message        // required, proto Message
	ByName                    string            // required, 生成名称
	Version                   string            // required, 生成版本
	PackageName               string            // required, proto 包名
	Options                   map[string]string // required, proto option
	Style                     string            // 字段代码风格, snakeCase, smallCamelCase, camelCase
	DisableDocComment         bool              // 禁用doc注释
	DisableBool               bool              // 禁用bool,使用int32
	DisableTimestamp          bool              // 禁用google.protobuf.Timestamp,使用int64
	EnableOpenapiv2Annotation bool              // 启用int64的openapiv2注解
	// contains filtered or unexported fields
}

func (*CodeGen) Bytes

func (g *CodeGen) Bytes() []byte

Bytes returns the CodeBuf's buffer.

func (*CodeGen) Gen

func (g *CodeGen) Gen() *CodeGen

func (*CodeGen) Print

func (g *CodeGen) Print(a ...any) (n int, err error)

Print formats using the default formats for its operands and writes to the generated output. Spaces are added between operands when neither is a string. It returns the number of bytes written and any write error encountered.

func (*CodeGen) Printf

func (g *CodeGen) Printf(format string, a ...any) (n int, err error)

Printf formats according to a format specifier for its operands and writes to the generated output. It returns the number of bytes written and any write error encountered.

func (*CodeGen) Println

func (g *CodeGen) Println(a ...any) (n int, err error)

Fprintln formats using the default formats to the generated output. Spaces are always added between operands and a newline is appended. It returns the number of bytes written and any write error encountered.

func (*CodeGen) Write

func (g *CodeGen) Write(b []byte) (n int, err error)

Write appends the contents of p to the buffer,

type Message

type Message struct {
	Name      string          // 名称, camel case
	TableName string          // 表名, snake name
	Comment   string          // 注释
	Fields    []*MessageField // 字段
}

type MessageField

type MessageField struct {
	Cardinality protoreflect.Cardinality // optional, required, or repeated
	Type        protoreflect.Kind        // 类型
	TypeName    string                   // 类型名称, 如果Type=protoreflect.MessageKind时
	Name        string                   // 名称, snake or small camel case
	ColumnName  string                   // 列名, snake case
	Comment     string                   // 注释
}

type Schema

type Schema struct {
	Name     string
	Entities []*Message
}

Jump to

Keyboard shortcuts

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