feat(stringx): add stringx init interface

This commit is contained in:
bandl 2021-09-16 13:53:52 +08:00
parent c84873208b
commit 40dd0dd91a
5 changed files with 63 additions and 3 deletions

1
pkg/structure/define.go Normal file
View File

@ -0,0 +1 @@
package structure

View File

@ -1 +0,0 @@
package define

View File

@ -1,4 +1,4 @@
package define
package structure
type CacheValue interface {
LengthByte() int64
@ -9,9 +9,11 @@ type ParseComm func(comm string) ([]string, error)
type CacheStruct interface {
SizeByte() int64
// RollBack 事务相关
// TODO RollBack 事务相关, V2 实现
RollBack() error
// Begin 事务相关, V2 实现
Begin() error
// Comment 事务相关, V2 实现
Comment() error
ParseCommend(comm ParseComm) ([]string, error)

View File

@ -0,0 +1 @@
package stringx

View File

@ -0,0 +1,57 @@
package stringx
import (
"unsafe"
structure "gitee.com/timedb/wheatCache/pkg/structure/define"
)
type StringxInt struct {
val int
}
type StringxFloat struct {
val float64
}
type Stringx struct {
ValFloat StringxFloat
ValInt StringxInt
ValString string
}
func (s *Stringx) SizeByte() int64 {
size := unsafe.Sizeof(s)
return int64(size)
}
// RollBack 事务相关, V2 实现
func (s *Stringx) RollBack() error {
panic("not implemented") // TODO: Implement
}
// Begin 事务相关, V2 实现
func (s *Stringx) Begin() error {
panic("not implemented") // TODO: Implement
}
// RollBack 事务相关, V2 实现
func (s *Stringx) Comment() error {
panic("not implemented") // TODO: Implement
}
func (s *Stringx) ParseCommend(comm structure.ParseComm) ([]string, error) {
panic("not implemented") // TODO: Implement
}
func (s *Stringx) GetValue(opt ...string) structure.CacheValue {
panic("not implemented") // TODO: Implement
}
func (s *Stringx) SetValue(opt ...string) error {
panic("not implemented") // TODO: Implement
}
func (s *Stringx) Encode() ([]byte, error) {
panic("not implemented") // TODO: Implement
}