From 70a246f84c9e5501eab4e4453fd3e6706a5301c0 Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Thu, 21 Oct 2021 16:18:30 +0800 Subject: [PATCH] feat(listx): add listx interface --- pkg/structure/interface.gen.go | 12 ++++++ pkg/structure/listx/listx.go | 68 ++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 pkg/structure/listx/listx.go diff --git a/pkg/structure/interface.gen.go b/pkg/structure/interface.gen.go index 29cfec8..112137a 100644 --- a/pkg/structure/interface.gen.go +++ b/pkg/structure/interface.gen.go @@ -24,3 +24,15 @@ type StringXInterface interface { Getrange(start, end int32) (string, error) GetLength() int } + +type ListXInterface interface { + KeyBaseInterface + LPush([]string) UpdateLength + RPush([]string) UpdateLength + LPop(int) ([]string, UpdateLength, error) + RPop(int) ([]string, UpdateLength, error) + Index(int) (string, error) + Insert(int, bool, []string) (UpdateLength, error) + Length() int + Slice(start, end int) (UpdateLength, error) // 切片, O(n)复杂度 +} diff --git a/pkg/structure/listx/listx.go b/pkg/structure/listx/listx.go new file mode 100644 index 0000000..56b8577 --- /dev/null +++ b/pkg/structure/listx/listx.go @@ -0,0 +1,68 @@ +package listx + +import "gitee.com/timedb/wheatCache/pkg/structure" + +/* +1. 双向链表 +2. 支持头尾操作 +3. 支持索引 +4. 支持切片 +*/ + +type Listx struct { +} + +func (l *Listx) SizeByte() int64 { + panic("not implemented") // TODO: Implement +} + +// RollBack TODO 事务相关, V2 实现 +func (l *Listx) RollBack() error { + panic("not implemented") // TODO: Implement +} + +// Begin 事务相关, V2 实现 +func (l *Listx) Begin() error { + panic("not implemented") // TODO: Implement +} + +// Comment 事务相关, V2 实现 +func (l *Listx) Comment() error { + panic("not implemented") // TODO: Implement +} + +func (l *Listx) Encode() ([]byte, error) { + panic("not implemented") // TODO: Implement +} + +func (l *Listx) LPush(_ []string) structure.UpdateLength { + panic("not implemented") // TODO: Implement +} + +func (l *Listx) RPush(_ []string) structure.UpdateLength { + panic("not implemented") // TODO: Implement +} + +func (l *Listx) LPop(_ int) ([]string, structure.UpdateLength, error) { + panic("not implemented") // TODO: Implement +} + +func (l *Listx) RPop(_ int) ([]string, structure.UpdateLength, error) { + panic("not implemented") // TODO: Implement +} + +func (l *Listx) Index(_ int) (string, error) { + panic("not implemented") // TODO: Implement +} + +func (l *Listx) Insert(_ int, _ bool, _ []string) (structure.UpdateLength, error) { + panic("not implemented") // TODO: Implement +} + +func (l *Listx) Length() int { + panic("not implemented") // TODO: Implement +} + +func (l *Listx) Slice(start int, end int) (structure.UpdateLength, error) { + panic("not implemented") // TODO: Implement +}