core

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

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

Go to latest
Published: Mar 26, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxBatchSize = 8192
	IncrIdBits   = 12

	DefaultNamespace = "default"
)

Variables

This section is empty.

Functions

func GetFromMapString

func GetFromMapString(mpValue map[string]any, key string) string

func HttpBatchService

func HttpBatchService(gen *Generator) func(writer http.ResponseWriter, request *http.Request, params httprouter.Params)

func HttpService

func HttpService(gen *Generator) func(writer http.ResponseWriter, request *http.Request, params httprouter.Params)

func InitWorkerId

func InitWorkerId(g *Generator) error

func IsProdEnv

func IsProdEnv() bool

Types

type AppInfo

type AppInfo struct {
	Name string
	Port int
}

func GetAppInfo

func GetAppInfo() *AppInfo

type BatchIds

type BatchIds struct {
	Start int64 `json:"start"`
	End   int64 `json:"end"`
}

type Generator

type Generator struct {
	NameSpaces map[string]*NameSpace
	// contains filtered or unexported fields
}

func NewGenerator

func NewGenerator() *Generator

func (*Generator) GenBatchId

func (g *Generator) GenBatchId(name string, batch int64) ([]*BatchIds, error)

func (*Generator) GenOneId

func (g *Generator) GenOneId(name string) (int64, error)

func (*Generator) SetState

func (g *Generator) SetState(state bool)

func (*Generator) SetWorkerId

func (g *Generator) SetWorkerId(workerId int32)

type NameSpace

type NameSpace struct {
	sync.Mutex
	Name string
	// contains filtered or unexported fields
}

type ResultBatch

type ResultBatch struct {
	Code       int         `json:"code"`
	ErrMessage string      `json:"errMessage,omitempty"`
	BatchIds   []*BatchIds `json:"batchIds,omitempty"`
}

type ResultOne

type ResultOne struct {
	Code       int    `json:"code"`
	ErrMessage string `json:"errMessage,omitempty"`
	Id         int64  `json:"id,omitempty"`
}

Jump to

Keyboard shortcuts

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