rest

package
v0.0.0-...-cb6a984 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 15 Imported by: 3

Documentation

Overview

Author: yangzq80@gmail.com Date: 2021/3/21

Author: yangzq80@gmail.com Date: 2021-03-16

Author: yangzq80@gmail.com Date: 2023/2/28

Author: yangzq80@gmail.com Date: 2021-03-25

Author: yangzq80@gmail.com Date: 2021-03-16

Index

Constants

View Source
const (
	CACHE_BUCKET string = "meta"
)

Variables

This section is empty.

Functions

func DisableCors

func DisableCors() gin.HandlerFunc

Needed in order to disable CORS for local development

Types

type JsonStoreRest

type JsonStoreRest struct {
	D           *Storage
	BasicAuth   map[string]string // 使用BasicAuth 如 admin:admin
	DisableCors bool
}

func NewJsonStoreRest

func NewJsonStoreRest(dir string) *JsonStoreRest

func (*JsonStoreRest) ConfigHandles

func (s *JsonStoreRest) ConfigHandles(r *gin.Engine)
type Search struct {
	B        string `form:"b"`
	K        string `form:"k"`
	Node     string `form:"node"`
	Key      string `form:"key"`      // Search conditions key
	Value    string `form:"value"`    // Search conditions value
	Relation string `form:"relation"` // Search relation,default equal; equal,like,isNotEq
	ShortBy  string `form:"shortBy"`
	Page     int    `form:"page"`
	Size     int    `form:"size"`
	Fields   string `form:"fields"`
}

type Storage

type Storage struct {
	IdNode *snowflake.Node
	// contains filtered or unexported fields
}

func NewStorage

func NewStorage(dir string) *Storage

func (*Storage) CacheGet

func (s *Storage) CacheGet(key string, val *interface{})

func (*Storage) CacheGetString

func (s *Storage) CacheGetString(category string, kvKey string) string

func (*Storage) CachePut

func (s *Storage) CachePut(key string, val interface{})

通用 key:value 对象存储

func (*Storage) CachePutString

func (s *Storage) CachePutString(category string, kvKey string, kvValue string)

通用 key:value 字符串类型kv存储

func (*Storage) Create

func (s *Storage) Create(bucket string, key string, value interface{}) *model.Data

保存key,value. bucket类似table

func (*Storage) Delete

func (s *Storage) Delete(bucket string, key string)

根据key删除

func (*Storage) DeleteAll

func (s *Storage) DeleteAll(bucket string, key string) int

func (*Storage) DeleteList

func (s *Storage) DeleteList(bucket string, items interface{}, isData bool) int

func (*Storage) FIFO

func (s *Storage) FIFO(key string, val interface{}, size int)

func (*Storage) Read

func (s *Storage) Read(bucket string, key string) *model.Data

查询单个

func (*Storage) ReadAll

func (s *Storage) ReadAll(bucket string, key string) *model.Response

查询bucket中 key 全部

func (*Storage) ReadAllSort

func (s *Storage) ReadAllSort(bucket string, key string) *model.Response

func (*Storage) ReadOneRaw

func (s *Storage) ReadOneRaw(bucket string, key string) []byte

func (*Storage) ReadOneStruct

func (s *Storage) ReadOneStruct(bucket string, key string, v interface{}) error

查询单个,返回 Struct 对象

func (*Storage) Search

func (s *Storage) Search(search Search) *model.Response

func (*Storage) SearchStruct

func (s *Storage) SearchStruct(search Search, obj interface{}) *model.Response

func (*Storage) Update

func (s *Storage) Update(bucket string, key string, value interface{}) *model.Data

根据key更新

func (*Storage) UpdateMarshalValue

func (s *Storage) UpdateMarshalValue(bucket string, key string, value []byte) error

func (*Storage) UpdateWeight

func (s *Storage) UpdateWeight(bucket string, kid string) interface{}

Jump to

Keyboard shortcuts

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