# kplbase **Repository Path**: ymofen/kplbase ## Basic Information - **Project Name**: kplbase - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-11-16 - **Last Updated**: 2024-07-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 编码规范 ## 变量命名规范 * 变量名必须遵循驼峰式,首字母根据访问控制决定使用大写或小写。 * 特有名词时, 如果变量为私有,且特有名词为首个单词,则使用小写,如 apiKey, 其他情况都应当使用该名词原有的写法,如 APIKey * 数据库字段都采用小写, 并以f开头, 比如fid, fname * 若变量类型为bool类型,则名称应以Has,Is,Can或Allow开头,例如:canDel, isExists bool * 不要在 for 循环里面使用 defer,defer只有在函数退出时才会执行。 * 业务代码禁止使用 goto 。 * 当存在资源创建时,应紧跟defer释放资源, 先判断是否错误,再defer释放资源,例如: ```` rep, err := http.Get(url) if err != nil { return err } defer resp.Body.Close() ```` ## 类定义 * 使用this表示对象本身 ```` type TencentSMSApi struct{ } // 使用this func (this *TencentSMSApi) Config(){ } ```` ## JSON 规范 * key命名使用小烤串式命名方式:kebab-case ## 文件命名规范 * 插件文件命名 plgs.xxx.xxx * 包名文件夹 按照使用单词名词, plugs, 只允许ascii字符 * 基础类文件名按照使用单词名命名, 只允许ascii字符, 比如: areacommon.go ## 一些常用的特有名词 ```` // A GonicMapper that contains a list of common initialisms taken from golang/lint var LintGonicMapper = GonicMapper{ "API": true, "ASCII": true, "CPU": true, "CSS": true, "DNS": true, "EOF": true, "GUID": true, "HTML": true, "HTTP": true, "HTTPS": true, "ID": true, "IP": true, "JSON": true, "LHS": true, "QPS": true, "RAM": true, "RHS": true, "RPC": true, "SLA": true, "SMTP": true, "SSH": true, "TLS": true, "TTL": true, "UI": true, "UID": true, "UUID": true, "URI": true, "URL": true, "UTF8": true, "VM": true, "XML": true, "XSRF": true, "XSS": true, } ```` # 目录说明 ```` +-- base :基础类(有三方引用) +-- plugins :插件文件夹 ```` ## 基础类要求 1. 类文件, 类名.go, 类名.lxs.go 2. test文件, test/类名_test.go (功能函数的使用, 预期) 3. 说明文件, docs/类名.md (功能列表, 功能点输入, 输出) # 定义 ## 基础类定义 1. 移动账号控制台(获取token, 拉取列表, 修改密码) 2. 微信公众号接口(模板消息推送) 3. 腾讯短信(模板消息推送) 4. 数据转word, excel ## 基础插件 1. 通用入库 2. 通用数据库处理插件查询,更新,删除