gengorm

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

README

About

The plugin's implementation.

Having internal in its path prevents imports from outside of the project.

Code may move into a public package at the root of the repository if there is a use case.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Comment

func Comment(format string, args ...interface{}) protogen.Comments

func GenerateFile

func GenerateFile(fs flag.FlagSet, plugin *protogen.Plugin, proto *protogen.File) error

Types

type Field

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

func NewField

func NewField(msg *Message, proto *protogen.Field) (*Field, error)

func (*Field) Annotate

func (f *Field) Annotate(symbol string, loc protogen.Location)

func (*Field) Gen

func (f *Field) Gen()

func (*Field) Name

func (f *Field) Name() string

func (*Field) P

func (f *Field) P(v ...interface{})

type FieldType

type FieldType struct {
	Go   protogen.GoIdent
	JSON bool

	Gorm     protogen.GoIdent
	Pointer  bool
	Enum     bool
	Custom   bool
	External bool
	// contains filtered or unexported fields
}

func NewFieldType

func NewFieldType(field *Field) (*FieldType, error)

func (*FieldType) Gen

func (t *FieldType) Gen()

func (*FieldType) String

func (t *FieldType) String() string

TODO: Refactor

type File

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

File wraps the input .proto file and keeps information to generate code.

func NewFile

func NewFile(plugin *protogen.Plugin, proto *protogen.File) (*File, error)

func (*File) Annotate

func (f *File) Annotate(symbol string, loc protogen.Location)

func (*File) CRUD

func (f *File) CRUD() bool

func (*File) Gen

func (f *File) Gen()

func (*File) Model

func (f *File) Model() bool

func (*File) P

func (f *File) P(v ...interface{})

func (*File) Validate

func (f *File) Validate() bool

type Message

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

func NewMessage

func NewMessage(file *File, proto *protogen.Message) (*Message, error)

func (*Message) Annotate

func (m *Message) Annotate(symbol string, loc protogen.Location)

func (*Message) Gen

func (m *Message) Gen()

Gen generates GORM models and supporting APIs.

func (*Message) ModelName

func (m *Message) ModelName() string

func (*Message) P

func (m *Message) P(v ...interface{})

func (*Message) ProtoName

func (m *Message) ProtoName() string

Directories

Path Synopsis
test

Jump to

Keyboard shortcuts

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