Documentation
¶
Index ¶
- Variables
- func AddCtx(ctx ...*Context)
- func DelCtxByID(id uint)
- func Execute[REQ Request, RESP any](ctx *Context, request REQ, opts ...OptionFunc) (resp RESP, err error)
- func OptionalId(resp IdResponse) (id uint)
- func UpCtxByID(ctx *Context)
- type Context
- type CreateUpdateResp
- type IdResponse
- type OnlyIdType
- type Option
- type OptionFunc
- type Request
- type Response
- type Transformer
Constants ¶
This section is empty.
Variables ¶
View Source
var ( IdTypeFixedOptFn = func(opt *Option) { opt.Transformer(idTypeFixed) } DeviceTypeFixedOptFn = func(opt *Option) { opt.Transformer(deviceTypeFixed) } PowerStatusFixedOptFn = func(opt *Option) { opt.Transformer(powerStatusFixed) } GidTypeFixedOptFn = func(opt *Option) { opt.Transformer(gidTypeFixed) } )
Functions ¶
func DelCtxByID ¶
func DelCtxByID(id uint)
func Execute ¶
func Execute[REQ Request, RESP any](ctx *Context, request REQ, opts ...OptionFunc) (resp RESP, err error)
func OptionalId ¶
func OptionalId(resp IdResponse) (id uint)
Types ¶
type Context ¶
type Context struct {
ID uint
BaseUrl string
Key string
Secret string
// contains filtered or unexported fields
}
func GetCtxByID ¶
func GetCtxByUrl ¶
type CreateUpdateResp ¶
type CreateUpdateResp struct {
Success bool `json:"success"`
Error string `json:"error"`
Id uint `json:"id"`
}
func (CreateUpdateResp) Err ¶
func (c CreateUpdateResp) Err() (err error)
func (CreateUpdateResp) ID ¶
func (c CreateUpdateResp) ID() uint
func (CreateUpdateResp) Ok ¶
func (c CreateUpdateResp) Ok() (ok bool)
type IdResponse ¶
type OnlyIdType ¶
type OnlyIdType struct {
Id uint `json:"id"`
}
func NewOnlyIdType ¶
func NewOnlyIdType(id uint) OnlyIdType
type Option ¶ added in v1.0.2
type Option struct {
// contains filtered or unexported fields
}
func (*Option) Transformer ¶ added in v1.0.2
func (o *Option) Transformer(transformer Transformer) *Option
type OptionFunc ¶ added in v1.0.2
type OptionFunc func(opt *Option)
func JoinOptFunc ¶ added in v1.0.4
func JoinOptFunc(opt OptionFunc, opts ...OptionFunc) []OptionFunc
func Timeout ¶ added in v1.0.4
func Timeout(timeout time.Duration) OptionFunc
type Transformer ¶ added in v1.0.2
Click to show internal directories.
Click to hide internal directories.