thrift

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: Apache-2.0 Imports: 20 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	AnnotationQuery    = "api.query"
	AnnotationForm     = "api.form"
	AnnotationPath     = "api.path"
	AnnotationHeader   = "api.header"
	AnnotationCookie   = "api.cookie"
	AnnotationBody     = "api.body"
	AnnotationRawBody  = "api.raw_body"
	AnnotationJsConv   = "api.js_conv"
	AnnotationNone     = "api.none"
	AnnotationFileName = "api.file_name"

	AnnotationValidator = "api.vd"

	AnnotationGoTag = "go.tag"
)
View Source
const (
	ApiGet        = "api.get"
	ApiPost       = "api.post"
	ApiPut        = "api.put"
	ApiPatch      = "api.patch"
	ApiDelete     = "api.delete"
	ApiOptions    = "api.options"
	ApiHEAD       = "api.head"
	ApiAny        = "api.any"
	ApiPath       = "api.path"
	ApiSerializer = "api.serializer"
	ApiGenPath    = "api.handler_path"
)
View Source
const (
	ApiBaseDomain    = "api.base_domain"
	ApiServiceGroup  = "api.service_group"
	ApiServiceGenDir = "api.service_gen_dir" // handler_dir for handler_by_service
	ApiServicePath   = "api.service_path"    // declare the path to the service's handler according to this annotation for handler_by_method
)

Variables

View Source
var (
	ConstTrue = Symbol{
		IsValue: true,
		Type:    model.TypeBool,
		Value:   true,
		Scope:   &BaseThrift,
	}
	ConstFalse = Symbol{
		IsValue: true,
		Type:    model.TypeBool,
		Value:   false,
		Scope:   &BaseThrift,
	}
	ConstEmptyString = Symbol{
		IsValue: true,
		Type:    model.TypeString,
		Value:   "",
		Scope:   &BaseThrift,
	}
)
View Source
var (
	HttpMethodAnnotations = map[string]string{
		ApiGet:     "GET",
		ApiPost:    "POST",
		ApiPut:     "PUT",
		ApiPatch:   "PATCH",
		ApiDelete:  "DELETE",
		ApiOptions: "OPTIONS",
		ApiHEAD:    "HEAD",
		ApiAny:     "ANY",
	}

	HttpMethodOptionAnnotations = map[string]string{
		ApiGenPath: "handler_path",
	}

	BindingTags = map[string]string{
		AnnotationPath:    "path",
		AnnotationQuery:   "query",
		AnnotationHeader:  "header",
		AnnotationCookie:  "cookie",
		AnnotationBody:    "json",
		AnnotationForm:    "form",
		AnnotationRawBody: "raw_body",
	}

	SerializerTags = map[string]string{
		ApiSerializer: "serializer",
	}

	ValidatorTags = map[string]string{AnnotationValidator: "vd"}
)
View Source
var BaseThrift = parser.Thrift{}
View Source
var NameStyle = styles.NewNamingStyle("thriftgo")

Functions

func CheckTagOption

func CheckTagOption(opts *options.Option) []generator.Option

Types

type NameSpace

type NameSpace map[string]*Symbol

func LoadBaseIdentifier

func LoadBaseIdentifier() NameSpace

type PackageReference

type PackageReference struct {
	IncludeBase string
	IncludePath string
	Model       *model.Model
	Ast         *parser.Thrift
	Referred    bool
}

type Plugin

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

func (*Plugin) GetResponse

func (plugin *Plugin) GetResponse(files []generator.File, outputDir string) (*thriftgo_plugin.Response, error)

func (*Plugin) InsertTag

func (plugin *Plugin) InsertTag() ([]*thriftgo_plugin.Generated, error)

func (*Plugin) Run

func (plugin *Plugin) Run() int

type ResolvedSymbol

type ResolvedSymbol struct {
	Base string
	Src  string
	*Symbol
}

func (ResolvedSymbol) Expression

func (rs ResolvedSymbol) Expression() string

type Resolver

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

func NewResolver

func NewResolver(ast *parser.Thrift, model *model.Model, pkgMap map[string]string) (*Resolver, error)

func (*Resolver) ExportReferred

func (resolver *Resolver) ExportReferred(all, needMain bool) (ret []*PackageReference)

func (*Resolver) Get

func (resolver *Resolver) Get(name string) *Symbol

func (*Resolver) GetRefModel

func (resolver *Resolver) GetRefModel(includeBase string) (*model.Model, error)

func (*Resolver) LoadAll

func (resolver *Resolver) LoadAll(ast *parser.Thrift) error

func (*Resolver) LoadOne

func (resolver *Resolver) LoadOne(ast *parser.Thrift) (NameSpace, error)

func (*Resolver) ResolveConstantValue

func (resolver *Resolver) ResolveConstantValue(constant *parser.ConstValue) (model.Literal, error)

func (*Resolver) ResolveIdentifier

func (resolver *Resolver) ResolveIdentifier(id string) (ret ResolvedSymbol, err error)

func (*Resolver) ResolveType

func (resolver *Resolver) ResolveType(typ *parser.Type) (*model.Type, error)

func (*Resolver) ResolveTypeName

func (resolver *Resolver) ResolveTypeName(typ *parser.Type) (string, error)

type Symbol

type Symbol struct {
	IsValue bool
	Type    *model.Type
	Value   interface{}
	Scope   *parser.Thrift
}

Jump to

Keyboard shortcuts

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