From 781fc4b6b7c3ae06c58cb5c7575aedafe84e298c Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Sun, 29 Aug 2021 22:18:07 +0800 Subject: [PATCH] feat(struct): init struct interface --- pkg/structure/define/define.go | 1 + pkg/structure/define/interface.go | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 pkg/structure/define/define.go create mode 100644 pkg/structure/define/interface.go diff --git a/pkg/structure/define/define.go b/pkg/structure/define/define.go new file mode 100644 index 0000000..57c3969 --- /dev/null +++ b/pkg/structure/define/define.go @@ -0,0 +1 @@ +package define diff --git a/pkg/structure/define/interface.go b/pkg/structure/define/interface.go new file mode 100644 index 0000000..2d308cf --- /dev/null +++ b/pkg/structure/define/interface.go @@ -0,0 +1,22 @@ +package define + +type CacheValue interface { + LengthByte() int64 +} + +type ParseComm func(comm string) ([]string, error) + +type CacheStruct interface { + SizeByte() int64 + + // RollBack 事务相关 + RollBack() error + Begin() error + Comment() error + + ParseCommend(comm ParseComm) ([]string, error) + GetValue(opt ...string) CacheValue + SetValue(opt ...string) error + + Encode() ([]byte, error) +}