Documentation
¶
Overview ¶
Package patch is command set for patching service code.
Index ¶
- func AdaptMonoRepoCommand() *cobra.Command
- func CheckAndModifyDuplicateErrorCodeNO(errorCodeNOs []*ErrorCodeNOAst) error
- func CopyGOModCommand() *cobra.Command
- func CopyProtoCommand() *cobra.Command
- func CopyThirdPartyProtoCommand() *cobra.Command
- func DeleteJSONOmitemptyCommand() *cobra.Command
- func GenTypesPbCommand() *cobra.Command
- func GenerateDBInitCommand() *cobra.Command
- func ModifyDuplicateErrorCodeNumCommand() *cobra.Command
- func ModifyDuplicateErrorCodeOffsetCommand() *cobra.Command
- func ModifyProtoPackageCommand() *cobra.Command
- type Deconstruction
- type ErrorCodeNOAst
- type ErrorCodeOffset
- type ErrorCodeOffsetAst
- type Result
- type Visitor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdaptMonoRepoCommand ¶
AdaptMonoRepoCommand Adapt to mono-repo command
func CheckAndModifyDuplicateErrorCodeNO ¶ added in v1.13.0
func CheckAndModifyDuplicateErrorCodeNO(errorCodeNOs []*ErrorCodeNOAst) error
CheckAndModifyDuplicateErrorCodeNO check and modify duplicate error code NO
func CopyProtoCommand ¶
CopyProtoCommand copy proto file from the grpc service directory
func CopyThirdPartyProtoCommand ¶
CopyThirdPartyProtoCommand copy third-party proto files
func DeleteJSONOmitemptyCommand ¶
DeleteJSONOmitemptyCommand delete json omitempty
func GenTypesPbCommand ¶
GenTypesPbCommand generate types.proto code
func GenerateDBInitCommand ¶
GenerateDBInitCommand generate database initialization code
func ModifyDuplicateErrorCodeNumCommand ¶ added in v1.13.0
ModifyDuplicateErrorCodeNumCommand Command modify duplicate error code numbers
func ModifyDuplicateErrorCodeOffsetCommand ¶ added in v1.13.0
ModifyDuplicateErrorCodeOffsetCommand modify duplicate error code offset command
func ModifyProtoPackageCommand ¶
ModifyProtoPackageCommand modifies the package and go_package names of proto files.
Types ¶
type Deconstruction ¶ added in v1.13.0
Deconstruction is the struct for error code offset deconstruction
type ErrorCodeNOAst ¶ added in v1.13.0
type ErrorCodeNOAst struct { FilePath string SrcCode string VarName string // example: userExampleNO VarValue int // example: 1 VarSrcCode string // example: "userExampleNO = 1" // contains filtered or unexported fields }
ErrorCodeNOAst is the struct for error code NO
func NewErrorCodeNOAst ¶ added in v1.13.0
func NewErrorCodeNOAst(filePath string) ([]*ErrorCodeNOAst, error)
NewErrorCodeNOAst create a ErrorCodeNOAst object
func (*ErrorCodeNOAst) SaveToFile ¶ added in v1.13.0
func (e *ErrorCodeNOAst) SaveToFile(maxErrorCodeNO int) error
SaveToFile save the modified source code to file
type ErrorCodeOffset ¶ added in v1.13.0
type ErrorCodeOffset struct { Name string OffsetInfos []*Deconstruction VarNameCodeSrcMap map[string]string // varName -> varErrCodeSrc Body string // contains filtered or unexported fields }
ErrorCodeOffset is the struct for error code offset
func (*ErrorCodeOffset) CheckDuplicateErrorCodeOffset ¶ added in v1.13.0
func (c *ErrorCodeOffset) CheckDuplicateErrorCodeOffset(srcCode string) (string, bool)
CheckDuplicateErrorCodeOffset check if the error code offset has duplicate value
func (*ErrorCodeOffset) CheckMergedItems ¶ added in v1.13.0
func (c *ErrorCodeOffset) CheckMergedItems(srcCode string, codeInfo *ErrorCodeOffset) (string, bool)
CheckMergedItems check if the merged items have duplicate error code offset
type ErrorCodeOffsetAst ¶ added in v1.13.0
type ErrorCodeOffsetAst struct { FilePath string SrcCode string FileSize int ErrorCodeNameInfoMap map[string]*ErrorCodeOffset }
ErrorCodeOffsetAst is the struct for error code offset
func NewErrorCodeOffsetAst ¶ added in v1.13.0
func NewErrorCodeOffsetAst(filePath string) (*ErrorCodeOffsetAst, error)
NewErrorCodeOffsetAst create a ErrorCodeOffsetAst object