abcex up
This commit is contained in:
parent
c03c377165
commit
d14b45abdf
4 changed files with 21 additions and 12 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
v1.0.4, released 2025-01-07
|
||||||
|
* abcex to v4
|
||||||
|
|
||||||
|
v1.0.3, released 2024-09-20
|
||||||
|
* abcex to v3
|
||||||
|
|
||||||
|
v1.0.2, released 2024-08-29
|
||||||
|
* use GetNode interface
|
||||||
|
|
||||||
v1.0.1, released 2024-08-08
|
v1.0.1, released 2024-08-08
|
||||||
* split commands to value and object layer
|
* split commands to value and object layer
|
||||||
* abcex to v1.0.1
|
* abcex to v1.0.1
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -3,7 +3,7 @@ module g.arns.lt/zordsdavini/zordfsdb
|
||||||
go 1.22.5
|
go 1.22.5
|
||||||
|
|
||||||
require (
|
require (
|
||||||
g.arns.lt/zordsdavini/abcex/v3 v3.0.0
|
g.arns.lt/zordsdavini/abcex/v4 v4.0.4
|
||||||
github.com/otiai10/copy v1.14.0
|
github.com/otiai10/copy v1.14.0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -1,5 +1,5 @@
|
||||||
g.arns.lt/zordsdavini/abcex/v3 v3.0.0 h1:LnlDtaBBOpgicMI/dcBUxlu4r4+IFt/MD19JemphgFc=
|
g.arns.lt/zordsdavini/abcex/v4 v4.0.4 h1:idjvgkCjrjZfDxLyOcX7lCIdIndISDAkj77VCvhu8/c=
|
||||||
g.arns.lt/zordsdavini/abcex/v3 v3.0.0/go.mod h1:z2xqDlRFVnLMnCGpqRjbs9T9EY6lJKJnQmU3zJLSNq8=
|
g.arns.lt/zordsdavini/abcex/v4 v4.0.4/go.mod h1:/+//gYSUtJrdsmTtWNoffRO4xD1BuPRUMGW4ynet7iE=
|
||||||
github.com/otiai10/copy v1.14.0 h1:dCI/t1iTdYGtkvCuBG2BgR6KZa83PTclw4U5n2wAllU=
|
github.com/otiai10/copy v1.14.0 h1:dCI/t1iTdYGtkvCuBG2BgR6KZa83PTclw4U5n2wAllU=
|
||||||
github.com/otiai10/copy v1.14.0/go.mod h1:ECfuL02W+/FkTWZWgQqXPWZgW9oeKCSQ5qVfSc4qc4w=
|
github.com/otiai10/copy v1.14.0/go.mod h1:ECfuL02W+/FkTWZWgQqXPWZgW9oeKCSQ5qVfSc4qc4w=
|
||||||
github.com/otiai10/mint v1.5.1 h1:XaPLeE+9vGbuyEHem1JNk3bYc7KKqyI/na0/mLd/Kks=
|
github.com/otiai10/mint v1.5.1 h1:XaPLeE+9vGbuyEHem1JNk3bYc7KKqyI/na0/mLd/Kks=
|
||||||
|
|
18
zordfsdb.go
18
zordfsdb.go
|
@ -7,7 +7,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
abcex "g.arns.lt/zordsdavini/abcex/v3"
|
abcex "g.arns.lt/zordsdavini/abcex/v4"
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetNodes interface {
|
type GetNodes interface {
|
||||||
|
@ -175,9 +175,9 @@ func (db *DB) Inc(vpath string) bool {
|
||||||
val = "0"
|
val = "0"
|
||||||
}
|
}
|
||||||
|
|
||||||
valAbc := abcex.Decode(val)
|
valAbc := abcex.Decode(val, abcex.BASE62)
|
||||||
valAbc++
|
valAbc++
|
||||||
val = abcex.Encode(valAbc)
|
val = abcex.Encode(valAbc, abcex.BASE62)
|
||||||
|
|
||||||
os.WriteFile(path.Join(fullPath...), []byte(string(val)), 0644)
|
os.WriteFile(path.Join(fullPath...), []byte(string(val)), 0644)
|
||||||
err := db.Refresh()
|
err := db.Refresh()
|
||||||
|
@ -197,9 +197,9 @@ func (db *DB) Dec(vpath string) bool {
|
||||||
val = "0"
|
val = "0"
|
||||||
}
|
}
|
||||||
|
|
||||||
valAbc := abcex.Decode(val)
|
valAbc := abcex.Decode(val, abcex.BASE62)
|
||||||
valAbc--
|
valAbc--
|
||||||
val = abcex.Encode(valAbc)
|
val = abcex.Encode(valAbc, abcex.BASE62)
|
||||||
|
|
||||||
os.WriteFile(path.Join(fullPath...), []byte(string(val)), 0644)
|
os.WriteFile(path.Join(fullPath...), []byte(string(val)), 0644)
|
||||||
err := db.Refresh()
|
err := db.Refresh()
|
||||||
|
@ -287,7 +287,7 @@ func (db *DB) AddObject(vpath string) (string, error) {
|
||||||
maxId := int64(0)
|
maxId := int64(0)
|
||||||
notEmpty := false
|
notEmpty := false
|
||||||
for _, id := range ids {
|
for _, id := range ids {
|
||||||
idInt := abcex.Decode(id.Name())
|
idInt := abcex.Decode(id.Name(), abcex.BASE62)
|
||||||
if maxId <= idInt {
|
if maxId <= idInt {
|
||||||
maxId = idInt
|
maxId = idInt
|
||||||
notEmpty = true
|
notEmpty = true
|
||||||
|
@ -298,8 +298,8 @@ func (db *DB) AddObject(vpath string) (string, error) {
|
||||||
maxId++
|
maxId++
|
||||||
}
|
}
|
||||||
|
|
||||||
fullPath = append(fullPath, abcex.Encode(maxId))
|
fullPath = append(fullPath, abcex.Encode(maxId, abcex.BASE62))
|
||||||
fmt.Println(fullPath, maxId, abcex.Encode(maxId))
|
fmt.Println(fullPath, maxId, abcex.Encode(maxId, abcex.BASE62))
|
||||||
|
|
||||||
err = os.Mkdir(path.Join(fullPath...), 0750)
|
err = os.Mkdir(path.Join(fullPath...), 0750)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -311,5 +311,5 @@ func (db *DB) AddObject(vpath string) (string, error) {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
return abcex.Encode(maxId), nil
|
return abcex.Encode(maxId, abcex.BASE62), nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue