Documentation ¶
Index ¶
- type BaseJsonStore
- func (s *BaseJsonStore[T]) Add(record T) bool
- func (s *BaseJsonStore[T]) ById(id string) T
- func (s *BaseJsonStore[T]) Data() []T
- func (s *BaseJsonStore[T]) Init() error
- func (s *BaseJsonStore[T]) Refresh() error
- func (s *BaseJsonStore[T]) Save() error
- func (s *BaseJsonStore[T]) Update(record T) bool
- type BaseModel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseJsonStore ¶
type BaseJsonStore[T BaseModel[T]] struct { // contains filtered or unexported fields }
func NewStore ¶
func NewStore[T BaseModel[T]](jsonFile string) *BaseJsonStore[T]
func (*BaseJsonStore[T]) Add ¶
func (s *BaseJsonStore[T]) Add(record T) bool
add if not exist, or force replace it
func (*BaseJsonStore[T]) ById ¶
func (s *BaseJsonStore[T]) ById(id string) T
func (*BaseJsonStore[T]) Data ¶
func (s *BaseJsonStore[T]) Data() []T
func (*BaseJsonStore[T]) Init ¶
func (s *BaseJsonStore[T]) Init() error
load from json file, tmp use
func (*BaseJsonStore[T]) Refresh ¶
func (s *BaseJsonStore[T]) Refresh() error
func (*BaseJsonStore[T]) Update ¶
func (s *BaseJsonStore[T]) Update(record T) bool
add if not exist, or update it, not force
Click to show internal directories.
Click to hide internal directories.