pkg

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package strs provides string manipulation functionality specific to protobuf.

Index

Constants

This section is empty.

Variables

View Source
var (
	GoBaseTypes = []string{
		"uint32",
		"uint64",
		"int32",
		"int64",
		"bool",
		"float32",
		"float64",
		"string",
	}
)

Functions

func EnumValueName

func EnumValueName(s string) string

EnumValueName derives the camel-cased enum value name. See protoc v3.8.0: src/google/protobuf/descriptor.cc:297-313

func FileExists added in v0.2.6

func FileExists(path string) bool

FileExists 判断所给路径文件/文件夹是否存在

func GoCamelCase

func GoCamelCase(s string) string

GoCamelCase camel-cases a protobuf name for use as a Go identifier.

If there is an interior underscore followed by a lower case letter, drop the underscore and convert the letter to upper case.

func GoSanitized

func GoSanitized(s string) string

GoSanitized converts a string to a valid Go identifier.

func IsGoBaseType added in v0.2.5

func IsGoBaseType(goType string) bool

IsGoBaseType 判断是否为 Go 基本数据类型

func JSONCamelCase

func JSONCamelCase(s string) string

JSONCamelCase converts a snake_case identifier to a camelCase identifier, according to the protobuf JSON specification.

func JSONSnakeCase

func JSONSnakeCase(s string) string

JSONSnakeCase converts a camelCase identifier to a snake_case identifier, according to the protobuf JSON specification.

func MapEntryName

func MapEntryName(s string) string

MapEntryName derives the name of the map entry message given the field name. See protoc v3.8.0: src/google/protobuf/descriptor.cc:254-276,6057

func TrimEnumPrefix

func TrimEnumPrefix(s, prefix string) string

TrimEnumPrefix trims the enum name prefix from an enum value name, where the prefix is all lowercase without underscores. See protoc v3.8.0: src/google/protobuf/descriptor.cc:330-375

Types

This section is empty.

Jump to

Keyboard shortcuts

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