trim

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 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 added in v0.3.14

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 added in v0.3.14

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 added in v0.3.3

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

type TrimResultInfo added in v0.3.15

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 added in v0.3.15

func (t *TrimResultInfo) FieldTrimmedPercentage() float64

func (*TrimResultInfo) FieldsLeft added in v0.3.15

func (t *TrimResultInfo) FieldsLeft() int

func (*TrimResultInfo) StructTrimmedPercentage added in v0.3.15

func (t *TrimResultInfo) StructTrimmedPercentage() float64

func (*TrimResultInfo) StructsLeft added in v0.3.15

func (t *TrimResultInfo) StructsLeft() int

type Trimmer

type Trimmer struct {
	PreservedFiles []string
	// contains filtered or unexported fields
}

type YamlArguments added in v0.3.3

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

func ParseYamlConfig added in v0.3.3

func ParseYamlConfig(path string) *YamlArguments

Jump to

Keyboard shortcuts

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