plugin

package
v0.0.0-...-3216734 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ENGINE_UNSET = iota
	ENGINE_POSTGRES
)

DB Engine Enum

View Source
const RESTRICT = "RESTRICT"

Variables

View Source
var AtlasAppToolkitVersion string
View Source
var ProtocGenGormVersion string

Functions

func CleanImports

func CleanImports(pFileText *string) *string

CleanImports removes extraneous imports and lines from a proto response file Content

Types

type Field

type Field struct {
	ParentGoType string
	Type         string
	Package      string
	*gorm.GormFieldOptions
	ParentOriginName string
}

func (*Field) String

func (f *Field) String() string

type OrmPlugin

type OrmPlugin struct {
	*generator.Generator

	EmptyFiles []string
	// contains filtered or unexported fields
}

OrmPlugin implements the plugin interface and creates GORM code from .protos

func (*OrmPlugin) CleanFiles

func (p *OrmPlugin) CleanFiles(response *plugin.CodeGeneratorResponse)

CleanFiles will prevent generation of any files where no real code is generated

func (*OrmPlugin) Generate

func (p *OrmPlugin) Generate(file *generator.FileDescriptor)

Generate produces the code generated by the plugin for this file, except for the imports, by calling the generator's methods P, In, and Out.

func (*OrmPlugin) GenerateImports

func (p *OrmPlugin) GenerateImports(file *generator.FileDescriptor)

GenerateImports writes out required imports for the generated files

func (*OrmPlugin) GetFileImports

func (p *OrmPlugin) GetFileImports() *fileImports

func (*OrmPlugin) Import

func (p *OrmPlugin) Import(packagePath string) string

Import takes a package and adds it to the list of packages to import It will generate a unique new alias using the last portion of the import path unless the package is already imported for this file. Either way, it returns the package alias

func (*OrmPlugin) Init

func (p *OrmPlugin) Init(g *generator.Generator)

Init is called once after data structures are built but before code generation begins.

func (*OrmPlugin) IsAbleToMakePQArray

func (p *OrmPlugin) IsAbleToMakePQArray(fieldType string) bool

IsAbleToMakePQArray tells us if the specific field-type can automatically be turned into a PQ array:

func (*OrmPlugin) Name

func (p *OrmPlugin) Name() string

Name identifies the plugin

func (*OrmPlugin) UsingGoImports

func (p *OrmPlugin) UsingGoImports(pkgNames ...string)

UsingGoImports should be used with basic packages like "time", or "context"

type OrmableType

type OrmableType struct {
	TableName   string
	OriginName  string
	Name        string
	Package     string
	File        *generator.FileDescriptor
	FieldNames  []string
	Fields      map[string]*Field
	Methods     map[string]*autogenMethod
	ForeignKeys [][]string
}

func NewOrmableType

func NewOrmableType(tablename, oname, pkg string, file *generator.FileDescriptor) *OrmableType

Jump to

Keyboard shortcuts

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