Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var FilepathResolver = func(path ...string) FileResolver { return func(s string) (string, error) { path := append(path, s) return filepath.Join(path...), nil } }
FilepathResolver resolver for files in directory path.
Functions ¶
func NewProtoMapper ¶
func NewProtoMapper(cfg *Config) *protoMapper
NewProtoMapper setup new protomapper.
func ScalarGoTypeName ¶
func ScalarGoTypeName(t ProtoScalar) string
ScalarGoTypeName get corresponding go type for protobuf scalar type.
Types ¶
type Config ¶
type Config struct {
// AppName - app name to include in generated comment.
AppName string
// TypesDir - folder, where types will be generated.
TypesDir string
// TypesGoPackage - go package name for generated types.
TypesGoPackage string
// ConvertersDir - folder, where type converters will be generated.
ConvertersDir string
// ConvertersGoPkg - go package for converters.
ConvertersGoPkg string
// TypesImport - import types package in converters.
TypesImport string
// PbImport - import protobuf generated package in converters.
PbImport string
}
Config protomapper configuration.
type FileResolver ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func WithExcludeMessageFields ¶
func WithExcludeMessageFields(exclude func(field ProtoField) bool) Option
func WithFieldMapper ¶
func WithFieldMapper(field Field, fromProto, toProto ProtoMapperFunc) Option
type ProtoField ¶
type ProtoMapperFunc ¶
type ProtoMapperFunc func(protoField ProtoField) func(src, dest string) string
type ProtoOption ¶
type ProtoScalar ¶
type ProtoScalar = ast.ScalarNode
type TypeMapper ¶
type TypeMapper interface {
FromProtoType(t ProtoType) (Type, error)
FromProtoField(f ProtoField) (Field, error)
}
TypeMapper mapper for protobuf types.
Click to show internal directories.
Click to hide internal directories.