logic

package
v0.0.0-...-0bc64af Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QueryAPI

func QueryAPI(logger *zap.Logger, storage Storage) echo.HandlerFunc

QueryAPI godoc @Summary query @Description query the text by tid @Tags HTTP API @Produce json @Param tid query string true "tid" @Router /query [get] @Success 200 {object} logic.Resp[string]

func ShareAPI

func ShareAPI(logger *zap.Logger, storage Storage) echo.HandlerFunc

ShareAPI godoc @Summary share @Description share the text @Tags HTTP API @Produce json @Param content formData string true "content" @Router /share [post] @Success 200 {object} logic.Resp[string]

Types

type RedisConfig

type RedisConfig struct {
	Addr       []string `json:"addr,omitempty"`
	Password   string   `json:"password,omitempty"`
	MasterName string   `json:"master_name,omitempty"`
}

type Resp

type Resp[T any] struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data T      `json:"data,omitempty"`
}

type Storage

type Storage interface {
	Put(ctx context.Context, value string, duration time.Duration) (key string, err error)
	Get(ctx context.Context, key string) (value string, err error)
}

func NewDefaultStorage

func NewDefaultStorage(config RedisConfig, logger *zap.Logger) Storage

Jump to

Keyboard shortcuts

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