init: taotie-api 项目初始化

This commit is contained in:
2026-05-16 00:14:19 +08:00
commit eb15ef4b87
33 changed files with 1746 additions and 0 deletions

38
common/common.go Normal file
View File

@@ -0,0 +1,38 @@
package common
type (
Map = map[string]any
MapAnyAny = map[any]any
MapAnyStr = map[any]string
MapAnyInt = map[any]int
MapAnyBool = map[any]bool
MapStrAny = map[string]any
MapStrStr = map[string]string
MapStrInt = map[string]int
MapStrBool = map[string]bool
MapIntAny = map[int]any
MapIntStr = map[int]string
MapIntInt = map[int]int
MapIntBool = map[int]bool
)
type (
List = []Map
ListAnyAny = []MapAnyAny
ListAnyStr = []MapAnyStr
ListAnyInt = []MapAnyInt
ListAnyBool = []MapAnyBool
ListStrAny = []MapStrAny
ListStrStr = []MapStrStr
ListStrInt = []MapStrInt
ListStrBool = []MapStrBool
ListIntAny = []MapIntAny
ListIntStr = []MapIntStr
ListIntInt = []MapIntInt
ListIntBool = []MapIntBool
)
const (
False = 0
True = 1
)

18
common/errsys.go Normal file
View File

@@ -0,0 +1,18 @@
package common
import (
"github.com/duke-git/lancet/v2/xerror"
)
var (
ErrSysOk = xerror.New("ok").Id("0") // 成功
ErrSysInternal = xerror.New("未知内部错误").Id("50") // 未知内部错误
ErrSysNil = xerror.New("空指针").Id("51") // 空指针
ErrSysValidationFailed = xerror.New("校验失败").Id("52") // 校验失败
ErrSysDbError = xerror.New("数据库错误").Id("53") // 数据库错误
ErrSysDuplicate = xerror.New("重复数据").Id("s0001") // 重复数据
ErrSysInvalid = xerror.New("数据无效").Id("s0002") // 数据无效
ErrSysDataNotFound = xerror.New("数据不存在").Id("s0003") // 数据不存在
)

10
common/erruser.go Normal file
View File

@@ -0,0 +1,10 @@
package common
import "github.com/duke-git/lancet/v2/xerror"
var (
ErrUserNotFound = xerror.New("用户不存在").Id("u001") // 用户不存在
ErrUserPasswordError = xerror.New("密码错误").Id("u002") // 密码错误
ErrUserTenantNotFound = xerror.New("租户不存在").Id("u003") // 租户不存在
ErrUserGenTokenFailed = xerror.New("生成token失败").Id("u004") // 生成token失败
)