trim

package
v0.3.18 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultYamlFileName = "trim_config.yaml"

Functions

func Trim

func Trim(files, includeDir []string, outDir string) error

Trim to trim thrift files to remove unused fields

func TrimBatchContent

func TrimBatchContent(mainIDLFilePath string, IDLFileContentMap map[string]string) (map[string]string, error)

TrimBatchContent receives a group of thrift idl as map[path]content and mainIDLPath, and return the result as the same format.

func TrimBatchContentWithConfig

func TrimBatchContentWithConfig(mainIDLFilePath string, IDLFileContentMap map[string]string, trimArgs TrimASTArg) (map[string]string, error)

TrimBatchContentWithConfig does the same work with TrimBatchContent, but can extra receive a trimArgs

Types

type TrimASTArg

type TrimASTArg struct {
	Ast         *parser.Thrift
	TrimMethods []string
	Preserve    *bool
	MatchGoName *bool
}

type TrimResultInfo

type TrimResultInfo struct {
	StructsTrimmed int
	FieldsTrimmed  int
	StructsTotal   int
	FieldsTotal    int
}

func TrimAST

func TrimAST(arg *TrimASTArg) (trimResultInfo *TrimResultInfo, err error)

TrimAST parse the cfg and trim the single AST

func (*TrimResultInfo) FieldTrimmedPercentage

func (t *TrimResultInfo) FieldTrimmedPercentage() float64

func (*TrimResultInfo) FieldsLeft

func (t *TrimResultInfo) FieldsLeft() int

func (*TrimResultInfo) StructTrimmedPercentage

func (t *TrimResultInfo) StructTrimmedPercentage() float64

func (*TrimResultInfo) StructsLeft

func (t *TrimResultInfo) StructsLeft() int

type Trimmer

type Trimmer struct {
	// contains filtered or unexported fields
}

type YamlArguments

type YamlArguments struct {
	Methods          []string `yaml:"methods,omitempty"`
	Preserve         *bool    `yaml:"preserve,omitempty"`
	PreservedStructs []string `yaml:"preserved_structs,omitempty"`
	MatchGoName      *bool    `yaml:"match_go_name,omitempty"`
}

func ParseYamlConfig

func ParseYamlConfig(path string) *YamlArguments

Jump to

Keyboard shortcuts

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