Documentation
¶
Index ¶
- func JoinPath(paths ...string) string
- func StripSlash(path string) string
- func WriteFile(filename string, content string) error
- type App
- func (a *App) Ctx(modifiers ...func(Context[any, any]) Context[any, any]) Context[any, any]
- func (a *App) GenerateSpec()
- func (a *App) Get(route Route) string
- func (a *App) Injector() *do.Injector
- func (a *App) Post(route Route) string
- func (a *App) Router(path string, procedures ...func(string, IApp)) IApp
- func (a *App) Server() *echo.Echo
- func (a *App) Spec(modifier func(TRPCSpec) TRPCSpec)
- func (a *App) Start(port int) error
- func (a *App) Use(middlewares ...ProcedureCallback[any, any]) IApp
- type Context
- func (c *Context[T, R]) Header(key string) string
- func (c *Context[T, R]) Json(status int, body R) error
- func (c *Context[T, R]) Locals(key string, value ...interface{}) interface{}
- func (c *Context[T, R]) Redirect(status int, url string) error
- func (c *Context[T, R]) String(status int, body string) error
- type FieldDescriptor
- type IApp
- type IProcedure
- type Procedure
- func (p *Procedure[T, R]) Input(v *validation.Validator) IProcedure[T, R]
- func (p *Procedure[T, R]) Mutation(callback ProcedureCallback[T, R]) func(string, IApp)
- func (p *Procedure[T, R]) Query(callback ProcedureCallback[T, R]) func(string, IApp)
- func (p *Procedure[T, R]) Use(middlewares ...ProcedureCallback[T, R]) IProcedure[T, R]
- type ProcedureCallback
- type Route
- type TRPCSpec
- type TypeDescriptor
- type XRPCConfig
- type XRPCError
- type XRPCSpecProcedure
- type XRPCSpecProcedureType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StripSlash ¶
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
func (*App) GenerateSpec ¶
func (a *App) GenerateSpec()
type Context ¶
type Context[T, R any] struct { Injector *do.Injector Input T // contains filtered or unexported fields }
type FieldDescriptor ¶
type IApp ¶
type IApp interface {
Injector() *do.Injector
Spec(modifier func(TRPCSpec) TRPCSpec)
GenerateSpec()
Server() *echo.Echo
Ctx(...func(Context[any, any]) Context[any, any]) Context[any, any]
Use(...ProcedureCallback[any, any]) IApp
Router(string, ...func(string, IApp)) IApp
Get(Route) string
Post(Route) string
Start(port int) error
}
func NewXRPC ¶
func NewXRPC(cfg ...XRPCConfig) IApp
type IProcedure ¶
type IProcedure[T, R any] interface { Input(*validation.Validator) IProcedure[T, R] Use(...ProcedureCallback[T, R]) IProcedure[T, R] Query(ProcedureCallback[T, R]) func(string, IApp) Mutation(ProcedureCallback[T, R]) func(string, IApp) }
func NewProcedure ¶
func NewProcedure[T, R any](name string) IProcedure[T, R]
type Procedure ¶
type Procedure[T, R any] struct { // contains filtered or unexported fields }
func (*Procedure[T, R]) Input ¶
func (p *Procedure[T, R]) Input(v *validation.Validator) IProcedure[T, R]
func (*Procedure[T, R]) Mutation ¶
func (p *Procedure[T, R]) Mutation(callback ProcedureCallback[T, R]) func(string, IApp)
func (*Procedure[T, R]) Query ¶
func (p *Procedure[T, R]) Query(callback ProcedureCallback[T, R]) func(string, IApp)
func (*Procedure[T, R]) Use ¶
func (p *Procedure[T, R]) Use(middlewares ...ProcedureCallback[T, R]) IProcedure[T, R]
type ProcedureCallback ¶
type TRPCSpec ¶
type TRPCSpec struct {
Name string `yaml:"name"`
ServerUrl string `yaml:"server_url"`
Procedures []XRPCSpecProcedure `yaml:"procedures"`
}
type TypeDescriptor ¶
type TypeDescriptor struct {
TypeName string `yaml:"type_name,omitempty"`
Fields []FieldDescriptor `yaml:"fields,omitempty"`
Nillable bool `yaml:"nillable"`
Array *TypeDescriptor `yaml:"array,omitempty"`
}
type XRPCConfig ¶
type XRPCSpecProcedure ¶
type XRPCSpecProcedure struct {
Path string `yaml:"path"`
Type XRPCSpecProcedureType `yaml:"type"`
Input TypeDescriptor `yaml:"input"`
Output TypeDescriptor `yaml:"output"`
}
type XRPCSpecProcedureType ¶
type XRPCSpecProcedureType string
const ( XRPCSpecProcedureTypeQuery XRPCSpecProcedureType = "Query" XRPCSpecProcedureTypeMutation XRPCSpecProcedureType = "Mutation" )
Directories
¶
| Path | Synopsis |
|---|---|
|
example
|
|
|
basic-server
command
|
|
|
go-client
command
|
|
|
ts-client
command
|
|
|
validation
command
|
|
Click to show internal directories.
Click to hide internal directories.