transform

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddressOf added in v0.1.0

func AddressOf(s string) string

func Args2ProtoFields

func Args2ProtoFields(args types.Args) []types.ProtoField

func Decimal2String added in v0.1.0

func Decimal2String(s string) string

func Error2String added in v0.1.0

func Error2String(s string) string

func ErrorString added in v0.1.0

func ErrorString(s string) string

func Fields2ProtoFields added in v0.1.0

func Fields2ProtoFields(args []types.Field) []types.ProtoField

func Go2ProtobufType

func Go2ProtobufType(s string) string

func Hex2Address added in v0.1.8

func Hex2Address(s string) string

func Int2Int32 added in v0.1.0

func Int2Int32(s string) string

func Int322Int added in v0.1.0

func Int322Int(s string) string

func Interface2ExchangeStructs

func Interface2ExchangeStructs(iface types.Interface) []types.ExchangeStruct

func Interface2ProtoService

func Interface2ProtoService(iface types.Interface) types.ProtoService

func NameEmptyArgsInInterface added in v0.1.1

func NameEmptyArgsInInterface(iface *types.Interface)

func NewDecoder added in v0.1.0

func NewDecoder(s string) string

func NewEncoder added in v0.1.0

func NewEncoder(s string) string

func NoOpConverter added in v0.1.0

func NoOpConverter(s string) string

func Proto2Time added in v0.1.0

func Proto2Time(s string) string

func RenameArg

func RenameArg(arg *types.Arg)

func RenameArgsInInterface

func RenameArgsInInterface(iface types.Interface)

func RenameEmpty added in v0.1.0

func RenameEmpty(t types.Type) string

func RenameExchangeStruct

func RenameExchangeStruct(exchangeStruct types.ExchangeStruct) types.ExchangeStruct

func ServiceError added in v0.1.0

func ServiceError(s string) string

func String2Error added in v0.1.0

func String2Error(s string) string

func StringMethod added in v0.1.8

func StringMethod(s string) string

func Struct2ProtoMessage

func Struct2ProtoMessage(ctx *extract.Context, s types.Struct) types.ProtoMessage

func TODOField added in v0.1.0

func TODOField(_ string) string

func Time2Proto added in v0.1.0

func Time2Proto(s string) string

func ToValue added in v0.1.0

func ToValue(s string) string

func ValueOf added in v0.1.0

func ValueOf(s string) string

Types

type Converter added in v0.1.0

type Converter struct {
	Type                types.Struct
	Proto               types.Struct
	StructName          string
	Expressions         map[types.Field]FieldExpression
	ConverterCalls      []ConverterCall
	IsSlice             bool
	IsPointer           bool
	IsInterface         bool
	Deps                map[DepIndex]Dependency
	Imports             utils.Set[types.Import]
	InterfaceConverters map[struct {
		// contains filtered or unexported fields
	}]InterfaceConverter
	ErrorHandler bool
}

func NewConverter added in v0.1.0

func NewConverter(t types.Struct, pb types.Struct, structName string) *Converter

func Structs2ProtoDecoder added in v0.1.0

func Structs2ProtoDecoder(ctx *extract.Context, ty, pb *types.Struct) Converter

func Structs2ProtoEncoder added in v0.1.0

func Structs2ProtoEncoder(ctx *extract.Context, ty, pb *types.Struct) Converter

type ConverterCall added in v0.1.0

type ConverterCall struct {
	FieldName     string
	ConverterName string
	Converter     FieldExpression
}

type DepIndex added in v0.1.0

type DepIndex struct {
	Type    string
	Proto   string
	IsSlice bool
}

type Dependency added in v0.1.0

type Dependency struct {
	Type        types.Struct
	Proto       types.Struct
	IsSlice     bool
	IsPointer   bool
	IsInterface bool
}

type FieldExpression added in v0.1.0

type FieldExpression struct {
	FieldExpressions []FieldExpressionFunc
	Field            types.Field
}

func (FieldExpression) Render added in v0.1.0

func (c FieldExpression) Render() string

type FieldExpressionFunc added in v0.1.0

type FieldExpressionFunc func(s string) string

func AddressFactory added in v0.1.0

func AddressFactory(t, pb types.Type) FieldExpressionFunc

func DereferenceFactory added in v0.1.0

func DereferenceFactory(t, pb types.Type) FieldExpressionFunc

func EmbeddedStructFactory added in v0.1.0

func EmbeddedStructFactory(t types.Type) FieldExpressionFunc

func NewEncoderFactory added in v0.1.0

func NewEncoderFactory(from, to string) FieldExpressionFunc

func SelectorFactory added in v0.1.0

func SelectorFactory(sel string) FieldExpressionFunc

type InterfaceConverter added in v0.1.0

type InterfaceConverter struct {
	Name  string
	Type  types.Interface
	Proto types.Struct
}

Jump to

Keyboard shortcuts

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