types

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	String  = Primitive("string")
	Bool    = Primitive("bool")
	Int     = Primitive("int")
	Float64 = Primitive("float64")
	Byte    = Primitive("byte")
)

Variables

This section is empty.

Functions

func NewField

func NewField(name string, comment []string, t Type) *field

Types

type Array

type Array struct {
	Elem Type
}

func ArrayOf

func ArrayOf(elem Type) *Array

func (*Array) GetComment

func (a *Array) GetComment() []string

func (*Array) GetFields

func (a *Array) GetFields() []Field

func (*Array) GetName

func (a *Array) GetName() string

func (*Array) IsStruct added in v0.0.6

func (a *Array) IsStruct() bool

func (*Array) String

func (a *Array) String() string

type Field

type Field interface {
	GetName() string
	GetComment() []string
	GetType() Type
}

type FieldMapper

type FieldMapper interface {
	FromPb(fieldName string) FieldMapperFunc
	ToPb(fieldName string) FieldMapperFunc
}

type FieldMapperFunc

type FieldMapperFunc = func(dest string) string

type FieldResolver added in v0.0.6

type FieldResolver interface {
	Resolve(field Field, pbType ast.Type) string
}

type ImportsResolver added in v0.0.6

type ImportsResolver interface {
	Resolve(typ Type, pbType ast.Type) []string
}

type Map

type Map struct {
	Key Primitive
	Val Type
}

func MapOf

func MapOf(key Primitive, val Type) *Map

func (*Map) GetComment

func (m *Map) GetComment() []string

func (*Map) GetFields

func (m *Map) GetFields() []Field

func (*Map) GetName

func (m *Map) GetName() string

func (*Map) IsStruct added in v0.0.6

func (m *Map) IsStruct() bool

func (*Map) String

func (m *Map) String() string

type Pointer

type Pointer struct {
	Type Type
}

func PointerOf

func PointerOf(t Type) *Pointer

func (*Pointer) GetComment

func (p *Pointer) GetComment() []string

func (Pointer) GetFields

func (p Pointer) GetFields() []Field

func (*Pointer) GetName

func (p *Pointer) GetName() string

func (*Pointer) IsStruct added in v0.0.6

func (p *Pointer) IsStruct() bool

func (*Pointer) String

func (p *Pointer) String() string

type Primitive

type Primitive string

func (Primitive) GetComment

func (t Primitive) GetComment() []string

func (Primitive) GetFields

func (t Primitive) GetFields() []Field

func (Primitive) GetName

func (t Primitive) GetName() string

func (Primitive) IsStruct added in v0.0.6

func (t Primitive) IsStruct() bool

func (Primitive) String

func (t Primitive) String() string

type Struct

type Struct struct {
	TypeName string
	Comment  []string
	Fields   []Field
}

func NewStruct

func NewStruct(name string, comment []string) *Struct

func (*Struct) GetComment

func (s *Struct) GetComment() []string

func (*Struct) GetFields

func (s *Struct) GetFields() []Field

func (*Struct) GetName

func (s *Struct) GetName() string

func (*Struct) IsStruct added in v0.0.6

func (s *Struct) IsStruct() bool

func (*Struct) String

func (s *Struct) String() string

type Type

type Type interface {
	GetName() string
	GetComment() []string
	GetFields() []Field
	IsStruct() bool
}

type TypeResolver added in v0.0.6

type TypeResolver interface {
	Resolve(typ Type, pbType ast.Type) string
}

Jump to

Keyboard shortcuts

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