gidhandler

package
v0.2.10-76 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCodeIDGenerateFailed = &errorpb.ErrCode{
	BizCode: int32(100),
	Code:    errorpb.Code_Internal,
	Name:    "gid.err_code.id_generate_failed",
	Reason:  "id generate error",
}
View Source
var ErrCodeOK = &errorpb.ErrCode{
	BizCode: int32(0),
	Code:    errorpb.Code_OK,
	Name:    "gid.err_code.ok",
	Reason:  "ok",
}

Functions

func New

func New(cron *scheduler.Scheduler, metric metrics.Metric) lava.HttpRouter

Types

type GenerateRequest

type GenerateRequest struct {
	// type of id e.g uuid, shortid, snowflake (64 bit), bigflake (128 bit)
	Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
}

type GenerateResponse

type GenerateResponse struct {
	// the unique id generated
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// the type of id generated
	Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
}

type Id

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

func (*Id) Annotation

func (t *Id) Annotation() []lava.Annotation

func (*Id) Generate

func (t *Id) Generate(ctx *fiber.Ctx, req *GenerateRequest) (*GenerateResponse, error)

func (*Id) Init

func (t *Id) Init()

func (*Id) Middlewares

func (t *Id) Middlewares() []lava.Middleware

func (*Id) Prefix

func (t *Id) Prefix() string

func (*Id) Router

func (t *Id) Router(router *lava.Router)

func (*Id) Types

func (t *Id) Types(ctx *fiber.Ctx, req *TypesRequest) (*TypesResponse, error)

type TypesRequest

type TypesRequest struct{}

List the types of IDs available. No query params needed.

type TypesResponse

type TypesResponse struct {
	Types []string `json:"types,omitempty" doc:"类型" required:"true" example:"[\"a\",\"b\"]" readOnly:"true"`
}

TypesResponse 返回值类型

Jump to

Keyboard shortcuts

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