gidhandler

package
v0.0.0-...-5c62cfe Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSrvErrCodeIDGenerateFailed = errors.NewCode(errorpb.Code_Internal).SetStatus("gid.srv.id_generate_failed").SetReason("id generate error")
View Source
var ErrSrvErrCodeOK = errors.NewCode(errorpb.Code_OK).SetStatus("gid.srv.ok").SetReason("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) Generate

func (t *Id) Generate(ctx context.Context, req *GenerateRequest) (*GenerateResponse, error)

func (*Id) Init

func (t *Id) Init()

func (*Id) Middlewares

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

func (*Id) Openapi

func (t *Id) Openapi(swag *opendoc.Swagger)

func (*Id) Router

func (t *Id) Router(app fiber.Router)

func (*Id) Types

func (t *Id) Types(ctx context.Context, req *TypesRequest) (*TypesResponse, error)

func (*Id) Version

func (t *Id) Version() string

type TypesRequest

type TypesRequest struct{}

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

type TypesResponse

type TypesResponse struct {
	Types []string `protobuf:"bytes,1,rep,name=types,proto3" json:"types,omitempty"`
}

TypesResponse 返回值类型

Jump to

Keyboard shortcuts

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