commit e3b25286a9d0f11793bfe697e232414e7b6d4083 Author: NoahLan <6995syu@163.com> Date: Fri Jul 28 23:37:00 2023 +0800 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6823151 --- /dev/null +++ b/.gitignore @@ -0,0 +1,52 @@ +### Go template +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Dependency directories (remove the comment below to include it) +# vendor/ + +################################################################################################################ +# Add 2020: +# +# ref: +# - https://github.com/caddyserver/caddy/blob/master/.gitignore +# +################################################################################################################ + +# macOS +.DS_Store + +# IDE: Goland +.idea/ + +# IDE: VS Code +.vscode/ + +# go mod +vendor/ + +tmp/ +*.log + +# *.pb.go +# *.pb.micro.go + +# artifacts from pprof tooling +*.prof + +# goreleaser artifacts +dist/ + + +# env file: +.env \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..e69de29 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e0643d4 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023-present, NoahLan + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..f38d594 --- /dev/null +++ b/README.md @@ -0,0 +1,73 @@ +
+

N-Admin

+
+ +--- + +## 简介 + +N-Admin 是一个开箱即用的分布式微服务框架,基于`go-zero`开发,为开发多种规模的后台提供了丰富的功能。 +支持代码生成,自带多种扩展。 + +## 文档 + +## 特性 + +- **技术栈** entgo, casbin, kafka, go-zero +- **Swagger** 支持`go-swagger` +- **统一错误处理** 基于国际化的统一错误处理,`rpc`输出错误信息`key`,`api`端输出国际化提示信息。 +- **国际化** 内置完善的`i18n`国际化支持 +- **服务注册发现** 兼容`etcd`, `nacos`, `consul`等注册发现中心 +- **配置中心** 使用`consul`, `nacos`等作为配置中心 +- **权限** 基于`casbin`,内置完善的权限管理系统 +- **其它** 流量控制,服务熔断等 + +## 功能点 + +- **用户管理** +- **部门管理** +- **岗位管理** +- **菜单管理** +- **角色管理** +- **数据字典** +- **操作日志** +- **接口文档** +- **服务监控** + +## 项目规划 + +## 预览 + +## 快速开始 + +## 更新日志 + +[CHANGELOG](./CHANGELOG.md) + +## 可选服务 + +## 如何贡献 + +非常欢迎你的加入! + +## Git提交规范 + +- 参考 [vue](https://github.com/vuejs/vue/blob/dev/.github/COMMIT_CONVENTION.md) 规范 ([Angular](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular)) + + - `feat` 增加新功能 + - `fix` 修复问题/BUG + - `style` 代码风格相关无影响运行结果的 + - `perf` 优化/性能提升 + - `refactor` 重构 + - `revert` 撤销修改 + - `test` 测试相关 + - `docs` 文档/注释 + - `chore` 依赖更新/脚手架配置修改等 + - `workflow` 工作流改进 + - `ci` 持续集成 + - `types` 类型定义文件更改 + - `wip` 开发中 + +## License + +[MIT © NoahLan-2023](./LICENSE) \ No newline at end of file diff --git a/dal/errors.go b/dal/errors.go new file mode 100644 index 0000000..cfd49c2 --- /dev/null +++ b/dal/errors.go @@ -0,0 +1,5 @@ +package dal + +import "errors" + +var ErrCacheNotFound = errors.New("cache object not found") diff --git a/dal/i18n/locale/en.json b/dal/i18n/locale/en.json new file mode 100644 index 0000000..10172a8 --- /dev/null +++ b/dal/i18n/locale/en.json @@ -0,0 +1,23 @@ +{ + "common": { + "success": "Successfully", + "failed": "Failed", + "updateSuccess": "Update successfully", + "updateFailed": "Update failed", + "createSuccess": "Create successfully", + "createFailed": "Create failed", + "deleteSuccess": "Delete successfully", + "deleteFailed": "Delete failed", + "objectNotFound": "Object not found", + "databaseError": "Database error", + "cacheError": "Cache error", + "constraintError": "Operation failed: Data conflict", + "validationError": "Operation failed: Validation failed", + "notSingularError": "Operation failed: Data not unique", + "permissionDeny": "User does not have permission to access this interface" + }, + "init": { + "alreadyInit": "Already initialized", + "initializeIsRunning": "Initialize is running" + } +} \ No newline at end of file diff --git a/dal/i18n/locale/zh.json b/dal/i18n/locale/zh.json new file mode 100644 index 0000000..848e565 --- /dev/null +++ b/dal/i18n/locale/zh.json @@ -0,0 +1,23 @@ +{ + "common": { + "success": "成功", + "failed": "失败", + "updateSuccess": "更新成功", + "updateFailed": "更新失败", + "createSuccess": "创建成功", + "createFailed": "创建失败", + "deleteSuccess": "删除成功", + "deleteFailed": "删除失败", + "objectNotFound": "对象未找到", + "databaseError": "数据库错误", + "cacheError": "缓存错误", + "constraintError": "操作失败: 数据冲突", + "validationError": "操作失败: 校验失败", + "notSingularError": "操作失败: 数据不唯一", + "permissionDeny": "用户无权限访问此接口" + }, + "init": { + "alreadyInit": "已初始化,请勿重复进行此操作", + "initializeIsRunning": "正在初始化,请稍等" + } +} \ No newline at end of file diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..abd812f --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module git.noahlan.cn/n-admin/n-admin-server + +go 1.20