config

package
v0.0.0-...-cd4d371 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2020 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JSON     = "json"
	TOML     = "toml"
	YAML     = "yaml"
	STRING   = "string"
	INT      = "int"
	BOOL     = "bool"
	FLOAT    = "float"
	TIME     = "time"
	DURATION = "duration"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	ID        uint64 `gorm:"comment:编号"`
	Name      string `gorm:"not null;size:32;comment:名;"`
	Key       string `gorm:"not null;size:32;uniqueIndex:kver;comment:键;"`
	Ver       uint   `gorm:"not null;uniqueIndex:kver;commit:版本"`
	Val       string `gorm:"not null;size:1024;comment:值;"`
	Format    string `gorm:"not null;size:32;comment:格式,枚举,string,int,bool,float,duration,time,json,toml,yaml;"`
	CreatedAt int64  `gorm:"comment:创建时间;"`
	// contains filtered or unexported fields
}

func (Item) Err

func (item Item) Err() error

func (Item) TableName

func (item Item) TableName() string

func (Item) To

func (item Item) To(out interface{}) (err error)

func (Item) Zero

func (item Item) Zero() bool

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, db *database.Service, cache *cache.Service) (*Service, error)

func (*Service) Del

func (s *Service) Del(ctx context.Context, key string) (err error)

func (*Service) Get

func (s *Service) Get(ctx context.Context, key string) Item

func (*Service) Gets

func (s *Service) Gets(ctx context.Context, key string) (items []Item, err error)

func (*Service) Init

func (s *Service) Init(ctx context.Context) error

func (*Service) ReadConfig

func (s *Service) ReadConfig(ctx context.Context, key, name string, opt interface{}) error

func (*Service) Set

func (s *Service) Set(ctx context.Context, name, key, val, format string) Item

func (*Service) SetObject

func (s *Service) SetObject(ctx context.Context, name, key, format string, v interface{}) Item

Jump to

Keyboard shortcuts

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