mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-21 02:04:26 +08:00
modify name
This commit is contained in:
+9
-9
@@ -10,14 +10,14 @@ const (
|
|||||||
SYSTEM_SUBCATEGORY_SETTING = 1
|
SYSTEM_SUBCATEGORY_SETTING = 1
|
||||||
SYSTEM_SUBCATEGORY_DATABASE = 2
|
SYSTEM_SUBCATEGORY_DATABASE = 2
|
||||||
|
|
||||||
NORMAL_SUBCATEGORY_GLOBAL = 0
|
NORMAL_SUBCATEGORY_GLOBAL = 0
|
||||||
NORMAL_SUBCATEGORY_USER = 1
|
NORMAL_SUBCATEGORY_USER = 1
|
||||||
NORMAL_SUBCATEGORY_TOKEN = 2
|
NORMAL_SUBCATEGORY_TOKEN = 2
|
||||||
NORMAL_SUBCATEGORY_TWOFACTOR = 3
|
NORMAL_SUBCATEGORY_TWOFACTOR = 3
|
||||||
NORMAL_SUBCATEGORY_ACCOUNT = 4
|
NORMAL_SUBCATEGORY_ACCOUNT = 4
|
||||||
NORMAL_SUBCATEGORY_JOURNAL = 5
|
NORMAL_SUBCATEGORY_TRANSACTION = 5
|
||||||
NORMAL_SUBCATEGORY_CATEGORY = 6
|
NORMAL_SUBCATEGORY_CATEGORY = 6
|
||||||
NORMAL_SUBCATEGORY_TAG = 7
|
NORMAL_SUBCATEGORY_TAG = 7
|
||||||
)
|
)
|
||||||
|
|
||||||
type Error struct {
|
type Error struct {
|
||||||
@@ -73,6 +73,6 @@ func Or(err error, defaultErr *Error) *Error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func IsCustomError(err error) bool {
|
func IsCustomError(err error) bool {
|
||||||
_, ok := err.(*Error);
|
_, ok := err.(*Error)
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import (
|
|||||||
func TestGenerateUuid(t *testing.T) {
|
func TestGenerateUuid(t *testing.T) {
|
||||||
expectedUnixTime := time.Now().Unix()
|
expectedUnixTime := time.Now().Unix()
|
||||||
expectedUuidServerId := uint8(90)
|
expectedUuidServerId := uint8(90)
|
||||||
expectedUuidType := UUID_TYPE_JOURNAL
|
expectedUuidType := UUID_TYPE_TRANSACTION
|
||||||
|
|
||||||
generator, _ := NewInternalUuidGenerator(&settings.Config{UuidServerId: expectedUuidServerId})
|
generator, _ := NewInternalUuidGenerator(&settings.Config{UuidServerId: expectedUuidServerId})
|
||||||
uuid := generator.GenerateUuid(expectedUuidType)
|
uuid := generator.GenerateUuid(expectedUuidType)
|
||||||
@@ -48,7 +48,7 @@ func TestGenerateUuid_MultiType(t *testing.T) {
|
|||||||
actualSeqId = uuidInfo.SequentialId
|
actualSeqId = uuidInfo.SequentialId
|
||||||
assert.Equal(t, uint32(expectedSeqId), actualSeqId)
|
assert.Equal(t, uint32(expectedSeqId), actualSeqId)
|
||||||
|
|
||||||
uuid = generator.GenerateUuid(UUID_TYPE_JOURNAL)
|
uuid = generator.GenerateUuid(UUID_TYPE_TRANSACTION)
|
||||||
uuidInfo = generator.ParseUuidInfo(uuid)
|
uuidInfo = generator.ParseUuidInfo(uuid)
|
||||||
actualSeqId = uuidInfo.SequentialId
|
actualSeqId = uuidInfo.SequentialId
|
||||||
assert.Equal(t, uint32(expectedSeqId), actualSeqId)
|
assert.Equal(t, uint32(expectedSeqId), actualSeqId)
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ package uuid
|
|||||||
type UuidType uint8
|
type UuidType uint8
|
||||||
|
|
||||||
const (
|
const (
|
||||||
UUID_TYPE_DEFAULT UuidType = 0
|
UUID_TYPE_DEFAULT UuidType = 0
|
||||||
UUID_TYPE_USER UuidType = 1
|
UUID_TYPE_USER UuidType = 1
|
||||||
UUID_TYPE_ACCOUNT UuidType = 2
|
UUID_TYPE_ACCOUNT UuidType = 2
|
||||||
UUID_TYPE_JOURNAL UuidType = 3
|
UUID_TYPE_TRANSACTION UuidType = 3
|
||||||
UUID_TYPE_CATEGORY UuidType = 4
|
UUID_TYPE_CATEGORY UuidType = 4
|
||||||
UUID_TYPE_TAG UuidType = 5
|
UUID_TYPE_TAG UuidType = 5
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user