gidhandler

package
v0.2.10-119 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCodeIDGenerateFailed = &errorpb.ErrCode{
	Code:       int32(100),
	Message:    "id generate error",
	Name:       "gid.id_generate_failed",
	StatusCode: errorpb.Code_Internal,
}
View Source
var ErrCodeOK = &errorpb.ErrCode{
	Code:       int32(0),
	Message:    "ok",
	Name:       "gid.ok",
	StatusCode: errorpb.Code_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 fiber.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