gen

package
v1.3.0 Latest Latest
Warning

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

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

README

About

The plugin's implementation.

Having internal in its path prevents imports from outside 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,
	packages *Packages,
) error

Types

type Collection added in v1.1.0

type Collection struct {
	Segment  string
	Title    string
	Document *Document
	Parent   *Document
	Message  *Message
}

func (*Collection) Merge added in v1.1.0

func (left *Collection) Merge(right *Collection) *Collection

func (*Collection) NestedDocumentTypeName added in v1.1.0

func (left *Collection) NestedDocumentTypeName(prefix string) string

func (*Collection) ParentDocumentTypeName added in v1.1.0

func (left *Collection) ParentDocumentTypeName(prefix string) string

func (*Collection) TypeName added in v1.1.0

func (left *Collection) TypeName(prefix string) string

func (*Collection) TypeNameIter added in v1.1.0

func (left *Collection) TypeNameIter(prefix string) string

func (*Collection) TypeNameQuery added in v1.1.0

func (left *Collection) TypeNameQuery(prefix string) string

type Document added in v1.1.0

type Document struct {
	Collections *orderedmap.OrderedMap[string, *Collection]
	Parent      *Collection
}

func (*Document) Merge added in v1.1.0

func (left *Document) Merge(right *Document) *Document

func (*Document) TypeName added in v1.1.0

func (left *Document) TypeName(prefix string) string

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) FirestoreFieldName

func (f *Field) FirestoreFieldName() string

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
	Firestore protogen.GoIdent

	IsPointer  bool // TODO: unused?
	IsEnum     bool
	IsCustom   bool
	IsExternal bool
	IsList     bool
	// contains filtered or unexported fields
}

func NewFieldType

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

func (*FieldType) String

func (t *FieldType) String() string

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) Enabled

func (f *File) Enabled() bool

func (*File) Gen

func (f *File) Gen()

func (*File) P

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

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) CollectionConstantName

func (m *Message) CollectionConstantName() string

func (*Message) CollectionName added in v1.1.0

func (m *Message) CollectionName() string

func (*Message) CollectionNameTitle added in v1.1.0

func (m *Message) CollectionNameTitle() string

func (*Message) CustomObjectName

func (m *Message) CustomObjectName() string

func (*Message) Gen

func (m *Message) Gen()

Gen generates GORM models and supporting APIs.

func (*Message) P

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

func (*Message) ProtoName

func (m *Message) ProtoName() string

type Package added in v1.1.0

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

func (*Package) CollectPath added in v1.1.0

func (p *Package) CollectPath(add *Path)

func (*Package) Gen added in v1.1.0

func (p *Package) Gen()

func (*Package) P added in v1.1.0

func (p *Package) P(v ...interface{})

type Packages added in v1.1.0

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

func NewPackages added in v1.1.0

func NewPackages(plugin *protogen.Plugin) *Packages

func (*Packages) Collect added in v1.1.0

func (p *Packages) Collect(file *File)

func (*Packages) Gen added in v1.1.0

func (p *Packages) Gen() error

type Path added in v1.1.0

type Path struct {
	Collection *Collection
}

Directories

Path Synopsis
test

Jump to

Keyboard shortcuts

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