typeAst

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2020 License: Apache-2.0 Imports: 14 Imported by: 3

README

TypeAst can

  • build a typeAst by reading a spec dir
  • save to spec dir
  • give you a type ast for more actions...

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Format = "json"

Functions

func IsScalar added in v1.11.0

func IsScalar(typename string) bool

Check for skalar types https://developers.google.com/protocol-buffers/docs/proto3#scalar

Types

type TypeAst

type TypeAst struct {
	SpecDir  string // the base path, like specDir or dependencies/x.y.com/specDir
	Path     string // relative path of spec file to SpecDir
	FileName string
	TypeSpec specSpec.Type
}

func (*TypeAst) GetProtoTarget

func (a *TypeAst) GetProtoTarget() (proto string)

func (*TypeAst) Save

func (a *TypeAst) Save(specDir string)

Stores the spec to disc

func (*TypeAst) ToJson

func (a *TypeAst) ToJson() (d []byte, err error)

func (*TypeAst) ToJsonFlat

func (a *TypeAst) ToJsonFlat() (d []byte, err error)

returns unindented json

func (*TypeAst) ToYaml

func (a *TypeAst) ToYaml() (d []byte, err error)

type Typelist

type Typelist struct {
	TypesByName          map[string]*TypeAst
	InstalledTypesByName map[string]*TypeAst
	AllAvailabeTypes     map[string]*TypeAst // installed and project types together
	SpecDir              string
}

func (*Typelist) DeleteType

func (l *Typelist) DeleteType(typename string)

Deletes the spec from disk and removes the element from List

func (*Typelist) LoadInstalledTypeSpecsFromDir

func (l *Typelist) LoadInstalledTypeSpecsFromDir(specDir ...string)

loads a spec directory and installed specs to the typelist

func (*Typelist) LoadTypeSpecsFromDir

func (l *Typelist) LoadTypeSpecsFromDir(specDir string)

loads a spec directory and installed specs to the typelist

func (Typelist) ResolveFullQualifiedTypeName added in v1.5.1

func (l Typelist) ResolveFullQualifiedTypeName(typename string, pkg string) string

full name from c++ style name

func (*Typelist) ResolveProtoImportForType

func (l *Typelist) ResolveProtoImportForType(typeName string, pkg string) (imp string, typeFound bool)

func (*Typelist) SaveAllTypeSpecsToDir

func (l *Typelist) SaveAllTypeSpecsToDir(specDir string)

stores the typelist to the spec directory

func (*Typelist) UpdateImports

func (l *Typelist) UpdateImports()

updates the imports on each type

Jump to

Keyboard shortcuts

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