Documentation ¶
Index ¶
Constants ¶
View Source
const PluginName = "thrift-gen-kitex"
PluginName is the link name when the kitex binary is used as a plugin for thriftgo.
View Source
const TheUseOptionMessage = "kitex_gen is not generated due to the -use option"
TheUseOptionMessage indicates that the generating of kitex_gen is aborted due to the -use option.
View Source
const (
Version = "v0.2.5"
)
Variables ¶
View Source
var FieldValidate = `` /* 299-byte string literal not displayed */
FieldValidate .
View Source
var FieldValidateBase = `` /* 647-byte string literal not displayed */
FieldValidateBase .
View Source
var FieldValidateContainer = `` /* 445-byte string literal not displayed */
FieldValidateContainer .
View Source
var FieldValidateList = `` /* 330-byte string literal not displayed */
FieldValidateList .
View Source
var FieldValidateMap = `` /* 325-byte string literal not displayed */
FieldValidateMap .
View Source
var FieldValidateSet = `` /* 328-byte string literal not displayed */
FieldValidateSet .
View Source
var FieldValidateStructLike = ` {{define "FieldValidateStructLike"}} {{- rule := range .Rules}} {{- if eq .Annotation $StructLikeAnnotation.Skip}} {{- else if eq . Annotation $StructLikeAnnotation.NotNil}} {{- end}} if !{{.Target}}.` + ValidMethodName + `({{.Source}}) { return false } {{- end}}{{/* "FieldValidateStructLike" */}} `
FieldValidateStructLike .
View Source
var StructLikeValidate = ` {{define "StructLikeValidate"}} {{- $TypeName := .Name | Identify}} func (p *{{$TypeName}}) ` + ValidMethodName + `() bool { {{- ctxs := MkValidateContexts .Fields}} {{- range .ctxs}} {{template "FieldValidate" .}} {{- end}}{{/* range .ctxs */}} return true } {{- end}}{{/* "StructLikeValidate" */}} `
StructLikeValidate .
View Source
var ValidMethodName string = "IsValid"
Functions ¶
Types ¶
type ValidateContext ¶
type ValidateContext struct { AST *tp.Thrift FieldName string RawFieldName string Resolver *golang.Resolver StructLike *golang.StructLike *golang.ReadWriteContext *parser.Validation IsOptional bool // contains filtered or unexported fields }
func (*ValidateContext) GenID ¶
func (v *ValidateContext) GenID(prefix string) (name string)
type ValidatorSDKPlugin ¶ added in v0.2.4
type ValidatorSDKPlugin struct {
PluginParameters []string
}
func NewValidatorSDKPlugin ¶ added in v0.2.4
func NewValidatorSDKPlugin(params string) *ValidatorSDKPlugin
func (*ValidatorSDKPlugin) GetName ¶ added in v0.2.4
func (k *ValidatorSDKPlugin) GetName() string
func (*ValidatorSDKPlugin) GetPluginParameters ¶ added in v0.2.4
func (k *ValidatorSDKPlugin) GetPluginParameters() []string
Click to show internal directories.
Click to hide internal directories.