{"id":17993874,"url":"https://github.com/timandy/gomybatis","last_synced_at":"2025-07-17T19:36:32.337Z","repository":{"id":37280885,"uuid":"450036477","full_name":"timandy/GoMybatis","owner":"timandy","description":"Mybatis for golang.","archived":false,"fork":false,"pushed_at":"2025-03-12T06:15:52.000Z","size":1797,"stargazers_count":9,"open_issues_count":5,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-21T01:34:22.565Z","etag":null,"topics":["go","golang","gomybatis","mybatis"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/timandy.png","metadata":{"files":{"readme":"README-ch.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-20T09:42:04.000Z","updated_at":"2025-03-12T06:15:56.000Z","dependencies_parsed_at":"2024-09-09T10:04:05.624Z","dependency_job_id":"beae589e-6f5b-44b6-b198-cbd90104db0d","html_url":"https://github.com/timandy/GoMybatis","commit_stats":null,"previous_names":[],"tags_count":108,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timandy%2FGoMybatis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timandy%2FGoMybatis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timandy%2FGoMybatis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timandy%2FGoMybatis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timandy","download_url":"https://codeload.github.com/timandy/GoMybatis/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245576522,"owners_count":20638123,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","gomybatis","mybatis"],"created_at":"2024-10-29T20:13:19.094Z","updated_at":"2025-03-26T02:30:37.568Z","avatar_url":"https://github.com/timandy.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 更简单的xml/sql风格 功能丰富 值得一试的ORM库\n\n## [网站](https://timandy.github.io/gomybatis.io/#/)\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/timandy/GoMybatis)](https://goreportcard.com/report/github.com/timandy/GoMybatis)\n[![Build Status](https://travis-ci.com/timandy/GoMybatis.svg?branch=master)](https://travis-ci.com/timandy/GoMybatis)\n[![GoDoc](https://godoc.org/github.com/timandy/GoMybatis?status.svg)](https://godoc.org/github.com/timandy/GoMybatis)\n[![Coverage Status](https://coveralls.io/repos/github/timandy/GoMybatis/badge.svg?branch=master)](https://coveralls.io/github/timandy/GoMybatis?branch=master)\n[![codecov](https://codecov.io/gh/timandy/GoMybatis/branch/master/graph/badge.svg)](https://codecov.io/gh/timandy/GoMybatis)\n\n![Image text](https://timandy.github.io/gomybatis.io/assets/vuetify.png)\n\n### 实际应用[点击-GoMybatis商城](https://github.com/timandy/GoMybatisMall)\n\n### 请仔细阅读[网站](https://timandy.github.io/gomybatis.io/#/)\n\n# future\n\n* \u003ca href=\"https://timandy.github.io/gomybatis.io/\"\u003e稳定\u003c/a\u003e，已应用生产环境App（电商/金融/卡充值类），功能稳定，适合各类 大小型项目以及复杂的金融项目,ERP项目 帮助您将数十万RMB轻松收入囊中\u003cbr\u003e\n* \u003ca href=\"https://timandy.github.io/gomybatis.io/\"\u003e高性能\u003c/a\u003e，单机最高可达751020 Qps/s,总耗时0.14s （测试环境返回模拟sql数据，并发1000，总数100000，6核16GB win10）\u003cbr\u003e\n* \u003ca href=\"https://timandy.github.io/gomybatis.io/\"\u003e无痛迁移\u003c/a\u003e，xml对于语言无关/低耦合，兼容大部分Java(Mybatis3,Mybatis Plus)框架逻辑，无痛苦Java Spring Mybatis的xml sql文件迁移至Go语言（仅修改resultMap的javaType为langType指定go语言类型）\u003cbr\u003e\n* \u003ca href=\"https://timandy.github.io/gomybatis.io/\"\u003e声明式事务、AOP事务、事务传播行为\u003c/a\u003e只需在函数尾部 定义`tx:\"\" rollback:\"error\"`即可启用声明式事务，事务传播行为,回滚策略.轻松应对复杂的事务嵌套/回滚\u003cbr\u003e\n* \u003ca href=\"https://timandy.github.io/gomybatis.io/\"\u003e扩展日志接口\u003c/a\u003e异步消息队列日,框架内sql日志使用带缓存的channel实现 消息队列异步记录日志\u003cbr\u003e\n* \u003ca href=\"https://timandy.github.io/gomybatis.io/\"\u003e动态SQL\u003c/a\u003e，在xml中`\u003cselect\u003e,\u003cupdate\u003e,\u003cinsert\u003e,\u003cdelete\u003e,\u003ctrim\u003e,\u003cif\u003e,\u003cset\u003e,\u003cwhere\u003e,\u003cforeach\u003e,\u003cresultMap\u003e,\u003cbind\u003e,\u003cchoose\u003e\u003cwhen\u003e\u003cotherwise\u003e,\u003csql\u003e\u003cinclude\u003e`等等java框架Mybatis包含的15种实用功能\u003cbr\u003e\n* \u003ca href=\"https://timandy.github.io/gomybatis.io/\"\u003e智能表达式\u003c/a\u003e可处理动态判断、计算任务（例如：`#{foo.Bar}#{arg+1}#{arg*1}#{arg/1}#{arg-1}`）,例如写模糊查询`select * from table where phone like #{phone+'%'}`(注意后置百分号走索引)\u003cbr\u003e\n* \u003ca href=\"https://timandy.github.io/gomybatis.io/\"\u003e动态数据源\u003c/a\u003e可自定义多数据源，动态切换多个数据库实例\u003cbr\u003e\n* \u003ca href=\"https://timandy.github.io/gomybatis.io/\"\u003e模板标签（新）\u003c/a\u003e一行代码实现增删改查，逻辑删除，乐观锁，而且还保留完美的扩展性（标签体内可以继续扩展sql逻辑）\u003cbr\u003e\n* \u003ca href=\"https://timandy.github.io/gomybatis.io/\"\u003e乐观锁（新）\u003c/a\u003e`\u003cupdateTemplate\u003e`乐观锁,尽可能防止并发竞争修改记录\u003cbr\u003e\n* \u003ca href=\"https://timandy.github.io/gomybatis.io/\"\u003e逻辑删除（新）\u003c/a\u003e`\u003cinsertTemplate\u003e\u003cupdateTemplate\u003e\u003cdeleteTemplate\u003e\u003cselectTemplate\u003e`逻辑删除,防止意外删除数据，数据恢复简单\u003cbr\u003e\n* \u003ca href=\"https://timandy.github.io/gomybatis.io/\"\u003eRPC/MVC组件支持（新）\u003c/a\u003e让服务完美支持RPC（减少参数限制）,动态代理，事务订阅，易于微服务集成和扩展 详情请点击链接https://github.com/timandy/easyrpc\u003cbr\u003e\n* \u003ca href=\"https://timandy.github.io/gomybatis.io/\"\u003eWrapper插件免写sql支持，Page分页插件支持（预计在golang1.17版本（支持泛型）之后出现）\u003cbr\u003e\n\n## 数据库驱动(支持所有基于标准库database/sql下的所有驱动)\n\n``` bash\n //传统数据库\n Mysql:                             github.com/go-sql-driver/mysql\n MyMysql:                           github.com/ziutek/mymysql/godrv\n Postgres:                          github.com/lib/pq\n SQLite:                            github.com/mattn/go-sqlite3\n MsSql:                             github.com/denisenkom/go-mssqldb\n Oracle:                            github.com/mattn/go-oci8\n //分布式NewSql数据库\n Tidb:                              github.com/go-sql-driver/mysql\n CockroachDB:                       github.com/lib/pq\n ```\n\n## 使用教程\n\n\u003e 教程源码  https://github.com/timandy/GoMybatis/tree/master/example\n\n* GoPath使用： go get 命令下载GoMybatis和对应的数据库驱动\n\n``` bash\ngo get github.com/timandy/GoMybatis\n```\n\n``` bash\n//驱动\ngo get github.com/go-sql-driver/mysql\n```\n\n* mod使用（环境变量加入GO111MODULE auto）:\n\n``` bash\n//命令行执行 禁止gosumdb\ngo env -w GOSUMDB=off\n```\n\n``` bash\n//go.mod加入依赖\nrequire (\n\tgithub.com/go-sql-driver/mysql v1.5.0\n\tgithub.com/timandy/GoMybatis v6.5.6+incompatible\n)\n```\n\n实际使用mapper 定义xml内容，建议以*Mapper.xml文件存于项目目录中,在编辑xml时就可享受GoLand等IDE渲染和智能提示。生产环境可以使用statikFS把xml文件打包进程序里\u003c/br\u003e\n\n* main.go\n\n``` xml\nvar xmlBytes = []byte(`\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003c!DOCTYPE mapper PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\"\n\"https://raw.githubusercontent.com/timandy/GoMybatis/master/mybatis-3-mapper.dtd\"\u003e\n\u003cmapper\u003e\n    \u003cselect id=\"SelectAll\"\u003e\n        select * from biz_activity where delete_flag=1 order by create_time desc\n    \u003c/select\u003e\n\u003c/mapper\u003e\n`)\n```\n\n``` go\nimport (\n\t\"fmt\"\n\t_ \"github.com/go-sql-driver/mysql\" //选择需要的数据库驱动导入\n\t\"github.com/timandy/GoMybatis\"\n)\ntype ExampleActivityMapperImpl struct {\n     SelectAll  func() ([]Activity, error)\n}\n\nfunc main() {\n    var engine = GoMybatis.GoMybatisEngine{}.New()\n\t//Mysql链接格式 用户名:密码@(数据库链接地址:端口)/数据库名称,如root:123456@(***.com:3306)/test\n\terr := engine.Open(\"mysql\", \"*?charset=utf8\u0026parseTime=True\u0026loc=Local\")\n\tif err != nil {\n\t   panic(err)\n\t}\n\tvar exampleActivityMapperImpl ExampleActivityMapperImpl\n\t\n\t//加载xml实现逻辑到ExampleActivityMapperImpl\n\tengine.WriteMapperPtr(\u0026exampleActivityMapperImpl, xmlBytes)\n\n\t//使用mapper\n\tresult, err := exampleActivityMapperImpl.SelectAll(\u0026result)\n        if err != nil {\n\t   panic(err)\n\t}\n\tfmt.Println(result)\n}\n```\n\n## 功能：模板标签CRUD 简化（依赖resultMap，同时带有 乐观锁.逻辑删除）\n\n``` xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003c!DOCTYPE mapper PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\"\n        \"https://raw.githubusercontent.com/timandy/GoMybatis/master/mybatis-3-mapper.dtd\"\u003e\n\u003cmapper\u003e\n    \u003c!--logic_enable 逻辑删除字段--\u003e\n    \u003c!--logic_deleted 逻辑删除已删除字段--\u003e\n    \u003c!--logic_undelete 逻辑删除 未删除字段--\u003e\n    \u003c!--version_enable 乐观锁版本字段,支持int,int8,int16,int32,int64--\u003e\n    \u003cresultMap id=\"BaseResultMap\" tables=\"biz_activity\"\u003e\n        \u003cid column=\"id\" langType=\"string\"/\u003e\n        \u003cresult column=\"name\" langType=\"string\"/\u003e\n        \u003cresult column=\"pc_link\" langType=\"string\"/\u003e\n        \u003cresult column=\"h5_link\" langType=\"string\"/\u003e\n        \u003cresult column=\"remark\" langType=\"string\"/\u003e\n        \u003cresult column=\"sort\" langType=\"int\"/\u003e\n        \u003cresult column=\"status\" langType=\"status\"/\u003e\n        \u003cresult column=\"version\" langType=\"int\"\n                version_enable=\"true\"/\u003e\n        \u003cresult column=\"create_time\" langType=\"time.Time\"/\u003e\n        \u003cresult column=\"delete_flag\" langType=\"int\"\n                logic_enable=\"true\"\n                logic_undelete=\"1\"\n                logic_deleted=\"0\"/\u003e\n    \u003c/resultMap\u003e\n\n    \u003c!--模板标签: columns wheres sets 支持逗号,分隔表达式，*?* 为判空表达式--\u003e\n\n    \u003c!--插入模板:默认id=\"insertTemplate,test=\"field != null\",where自动设置逻辑删除字段,支持批量插入\" --\u003e\n    \u003cinsertTemplate/\u003e\n    \u003c!--查询模板:默认id=\"selectTemplate,where自动设置逻辑删除字段--\u003e\n    \u003cselectTemplate wheres=\"name?name = #{name}\"/\u003e\n    \u003c!--更新模板:默认id=\"updateTemplate,set自动设置乐观锁版本号--\u003e\n    \u003cupdateTemplate sets=\"name?name = #{name},remark?remark=#{remark}\" wheres=\"id?id = #{id}\"/\u003e\n    \u003c!--删除模板:默认id=\"deleteTemplate,where自动设置逻辑删除字段--\u003e\n    \u003cdeleteTemplate wheres=\"name?name = #{name}\"/\u003e\n\u003c/mapper\u003e    \n```\n\nxml对应以下定义的Mapper结构体方法,然后将生成对应的SQL语句 旧版本使用mapperParams的tag，单词太长容易拼错，新版改为args\n\n```go\ntype Activity struct {\n\tId         string    `json:\"id\"`\n\tUuid       string    `json:\"uuid\"`\n\tName       string    `json:\"name\"`\n\tPcLink     string    `json:\"pcLink\"`\n\tH5Link     string    `json:\"h5Link\"`\n\tRemark     string    `json:\"remark\"`\n\tVersion    int       `json:\"version\"`\n\tCreateTime time.Time `json:\"createTime\"`\n\tDeleteFlag int       `json:\"deleteFlag\"`\n}\ntype ExampleActivityMapper struct {\n    //调用即可生成sql(带有逻辑删除)  select * from biz_activity where delete_flag = 1 and name = #{name}\n\tSelectTemplate      func(name string) ([]Activity, error) `args:\"name\"`\n\tInsertTemplate      func(arg Activity) (int64, error)\n\tInsertTemplateBatch func(args []Activity) (int64, error) `args:\"args\"`\n    //生成sql(带有乐观锁.逻辑删除)  update biz_activity set name = #{name},remark=#{remark},version=#{version+1} where delete_flag = 1 and id = #{id} and version = #{version}\n\tUpdateTemplate      func(arg Activity) (int64, error)    `args:\"name\"`\n\tDeleteTemplate      func(name string) (int64, error)     `args:\"name\"`\n}\n```\n\n## 功能：动态数据源\n\n``` go\n        //添加第二个mysql数据库,请把MysqlUri改成你的第二个数据源链接\n    var engine = GoMybatis.GoMybatisEngine{}.New()\n\tengine.Open(\"mysql\", MysqlUri)//添加第二个mysql数据库,请把MysqlUri改成你的第二个数据源链接\n\tvar router = GoMybatis.GoMybatisDataSourceRouter{}.New(func(mapperName string) *string {\n\t\t//根据包名路由指向数据源\n\t\tif strings.Contains(mapperName, \"example.\") {\n\t\t\tvar url = MysqlUri//第二个mysql数据库,请把MysqlUri改成你的第二个数据源链接\n\t\t\tfmt.Println(url)\n\t\t\treturn \u0026url\n\t\t}\n\t\treturn nil\n\t})\n\tengine.SetDataSourceRouter(\u0026router)\n```\n\n## 功能：自定义日志输出\n\n``` go\n\tengine.SetLogEnable(true)\n\tengine.SetLog(\u0026GoMybatis.LogStandard{\n\t\tPrintlnFunc: func(messages []byte) {\n\t\t  //do someting save messages\n\t\t},\n\t})\n```\n\n## 功能：异步日志接口（可自定义日志输出）\n\n![Image text](https://timandy.github.io/gomybatis.io/assets/log_system.png)\n\n## 功能：嵌套事务传播处理器\n\n \u003ctable\u003e\n \u003cthead\u003e\n \u003ctr\u003e\u003cth\u003e事务类型\u003c/th\u003e\n \u003cth\u003e说明\u003c/th\u003e\n \u003c/tr\u003e\n \u003c/thead\u003e\n \u003ctbody\u003e\u003ctr\u003e\u003ctd\u003ePROPAGATION_REQUIRED\u003c/td\u003e\u003ctd\u003e表示如果当前事务存在，则支持当前事务。否则，会启动一个新的事务。默认事务类型。\u003c/td\u003e\u003c/tr\u003e\n \u003ctr\u003e\u003ctd\u003ePROPAGATION_SUPPORTS\u003c/td\u003e\u003ctd\u003e表示如果当前事务存在，则支持当前事务，如果当前没有事务，就以非事务方式执行。\u003c/td\u003e\u003c/tr\u003e\n \u003ctr\u003e\u003ctd\u003ePROPAGATION_MANDATORY\u003c/td\u003e\u003ctd\u003e表示如果当前事务存在，则支持当前事务，如果当前没有事务，则返回事务嵌套错误。\u003c/td\u003e\u003c/tr\u003e\n \u003ctr\u003e\u003ctd\u003ePROPAGATION_REQUIRES_NEW\u003c/td\u003e\u003ctd\u003e表示新建一个全新Session开启一个全新事务，如果当前存在事务，则把当前事务挂起。\u003c/td\u003e\u003c/tr\u003e\n \u003ctr\u003e\u003ctd\u003ePROPAGATION_NOT_SUPPORTED\u003c/td\u003e\u003ctd\u003e表示以非事务方式执行操作，如果当前存在事务，则新建一个Session以非事务方式执行操作，把当前事务挂起。\u003c/td\u003e\u003c/tr\u003e\n \u003ctr\u003e\u003ctd\u003ePROPAGATION_NEVER\u003c/td\u003e\u003ctd\u003e表示以非事务方式执行操作，如果当前存在事务，则返回事务嵌套错误。\u003c/td\u003e\u003c/tr\u003e\n \u003ctr\u003e\u003ctd\u003ePROPAGATION_NESTED\u003c/td\u003e\u003ctd\u003e表示如果当前事务存在，则在嵌套事务内执行，如嵌套事务回滚，则只会在嵌套事务内回滚，不会影响当前事务。如果当前没有事务，则进行与PROPAGATION_REQUIRED类似的操作。\u003c/td\u003e\u003c/tr\u003e\n \u003ctr\u003e\u003ctd\u003ePROPAGATION_NOT_REQUIRED\u003c/td\u003e\u003ctd\u003e表示如果当前没有事务，就新建一个事务,否则返回错误。\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\n \u003c/table\u003e\n\n ``` go\n //嵌套事务的服务\ntype TestService struct {\n\texampleActivityMapper *ExampleActivityMapper //服务包含一个mapper操作数据库，类似java spring mvc\n\tUpdateName   func(id string, name string) error   `tx:\"\" rollback:\"error\"`\n\tUpdateRemark func(id string, remark string) error `tx:\"\" rollback:\"error\"`\n}\nfunc main()  {\n\tvar testService TestService\n\ttestService = TestService{\n\t\texampleActivityMapper: \u0026exampleActivityMapper,\n\t\tUpdateRemark: func(id string, remark string) error {\n\t\t\ttestService.exampleActivityMapper.SelectByIds([]string{id})\n\t\t\tpanic(errors.New(\"业务异常\")) // panic 触发事务回滚策略\n\t\t\treturn nil                   // rollback:\"error\"指定了返回error类型 且不为nil 就会触发事务回滚策略\n\t\t},\n\t\tUpdateName: func(id string, name string) error {\n\t\t\ttestService.exampleActivityMapper.SelectByIds([]string{id})\n\t\t\treturn nil\n\t\t},\n\t}\n\tGoMybatis.AopProxyService(\u0026testService, \u0026engine)//必须使用AOP代理服务的func\n\ttestService.UpdateRemark(\"1\",\"remark\")\n}\n```\n\n## 功能：XML/Mapper生成器- 根据struct结构体生成*mapper.xml\n\n``` go\n  //step1 定义你的数据库模型,必须包含 json注解（默认为数据库字段）, gm:\"\"注解指定 值是否为 id,version乐观锁,logic逻辑软删除\n  type UserAddress struct {\n\tId            string `json:\"id\" gm:\"id\"`\n\tUserId        string `json:\"user_id\"`\n\tRealName      string `json:\"real_name\"`\n\tPhone         string `json:\"phone\"`\n\tAddressDetail string `json:\"address_detail\"`\n\n\tVersion    int       `json:\"version\" gm:\"version\"`\n\tCreateTime time.Time `json:\"create_time\"`\n\tDeleteFlag int       `json:\"delete_flag\" gm:\"logic\"`\n}\n```\n\n* 第二步，在你项目main 目录下建立一个 XmlCreateTool.go 内容如下\n\n``` go\nfunc main() {\n\tvar bean = UserAddress{} //此处只是举例，应该替换为你自己的数据库模型\n\tGoMybatis.OutPutXml(reflect.TypeOf(bean).Name()+\"Mapper.xml\", GoMybatis.CreateXml(\"biz_\"+GoMybatis.StructToSnakeString(bean), bean))\n}\n```\n\n* 第三步，执行命令，在当前目录下得到 UserAddressMapper.xml文件\n\n``` go\ngo run XmlCreateTool.go\n```\n\n* 以下是自动生成的xml文件内容\n\n``` xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003c!DOCTYPE mapper PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\"\n        \"https://raw.githubusercontent.com/timandy/GoMybatis/master/mybatis-3-mapper.dtd\"\u003e\n\u003cmapper\u003e\n    \u003c!--logic_enable 逻辑删除字段--\u003e\n    \u003c!--logic_deleted 逻辑删除已删除字段--\u003e\n    \u003c!--logic_undelete 逻辑删除 未删除字段--\u003e\n    \u003c!--version_enable 乐观锁版本字段,支持int,int8,int16,int32,int64--\u003e\n    \u003cresultMap id=\"BaseResultMap\" tables=\"biz_user_address\"\u003e\n    \u003cid column=\"id\" property=\"id\"/\u003e\n\t\u003cresult column=\"id\" property=\"id\" langType=\"string\"   /\u003e\n\t\u003cresult column=\"user_id\" property=\"user_id\" langType=\"string\"   /\u003e\n\t\u003cresult column=\"real_name\" property=\"real_name\" langType=\"string\"   /\u003e\n\t\u003cresult column=\"phone\" property=\"phone\" langType=\"string\"   /\u003e\n\t\u003cresult column=\"address_detail\" property=\"address_detail\" langType=\"string\"   /\u003e\n\t\u003cresult column=\"version\" property=\"version\" langType=\"int\" version_enable=\"true\"  /\u003e\n\t\u003cresult column=\"create_time\" property=\"create_time\" langType=\"Time\"   /\u003e\n\t\u003cresult column=\"delete_flag\" property=\"delete_flag\" langType=\"int\"  logic_enable=\"true\" logic_undelete=\"1\" logic_deleted=\"0\" /\u003e\n    \u003c/resultMap\u003e\n\u003c/mapper\u003e\n```\n\n## 为了让您快速学习此框架，建议查看在实际项目中的应用 [点击-GoMybatis商城](https://github.com/timandy/GoMybatisMall)\n\n## 建议使用的框架（已应用在生产环境）配合GoMybatis\n\n#### [easy_mvc](https://github.com/timandy/easy_mvc)\n\n* 整体基于反射tag，所有配置（包括http方法，路径，参数，swagger文档参数）都集中于你定义的函数之后\n* 轻量 完全兼容标准库的http，意味着和标准库一般稳定，可以混合搭配使用，扩展性极高\n* 拦截器 支持（例如非常方便的检查用户登录，提取用户登录数据，支持JWT token，Oath2Token更加方便的接入）\n* 过滤器 支持\n* 全局错误处理器链 支持\n* 使用tag 定义 http请求参数，包含 *int,*string,*float 同时支持标准库的 writer http.ResponseWriter, request *http.Request\n* Json参数支持（app端上传时需要Header，Content-Type设置为application/json）\n* 支持参数默认值 只需在tag中 定义，例如 func(phone string, pwd string, age *int) interface{} arg:\"phone,pwd,age:1\"  其中 arg没有传参则默认为1\n* 指针参数可为空（nil）非指针参数 如果没有值框架会拦截\n* root path支持，类似spring controller定义一个基础的path加控制器具体方法的http path\n* 支持swagger ui 动态文档，免生成任何中间go文件 基于Tag和反射实现的swagger动态文档\n\n#### [easy_rpc](https://github.com/timandy/easyrpc)  （RPC框架，和GoMybatis配合更容易）\n\n* 基于标准库rpc库修改而来,稳定,高性能,扩展性好\n* 标准库默认使用func (* Type)Method(arg,*result) error 的模式,EasyRpc 则把方法移动到结构体里（方便动态代理和Aop以及各种扩展和定制）\n* easyrpc同时支持 无参数，无返回值，或只有参数，只有返回值\n* 支持注册defer函数 easyrpc.RegisterDefer(v,deferFunc) ，防止服务因为不可预知 painc 问题导致程序退出。defer函数可处理问题然后把错误发送还给客户端\n\n#### [easyrpc_discovery](https://github.com/timandy/easyrpc_discovery)  服务发现\n\n* 自带负载均衡算法 随机 加权轮询 源地址哈希法\n* 基于easyrpc,类似标准库的api，定义服务没有标准库的要求那么严格（可选不传参数，或者只有一个参数，只有一个返回值） https://github.com/timandy/easyrpc\n* 基于easyrpc，负载均衡算法，失败重试，支持动态代理，支持GoMybatis事务，AOP代理，事务嵌套，tag定义事务\n  ![Image text](https://timandy.github.io/gomybatis.io/assets/easy_consul.png)\n\n## 为了让您快速学习此框架，建议查看在实际项目中的应用 [点击-GoMybatis商城](https://github.com/timandy/GoMybatisMall)\n\n## 新特性规划\n\n* 内置方法explain目录下所有sql，获取每条sql是否走索引.避免上线后因为sql扫全表导致卡顿和死锁悲剧\n* 新项目 https://github.com/rbatis/rbatis 提供高性能，无GC,无并发安全问题，内存安全的rust语言 orm框架\n\n## 请及时关注版本，尽可能使用最新版本(稳定，修复bug)\n\n* 不管是商业用途还是个人使用GoMybatis项目，必须在Issues里留言您的项目名称+联系方式 ！\n\n## 联系方式：微信号 zxj347284221\n\n## 欢迎右上角star 或捐赠赞助~\n\n![Image text](https://timandy.github.io/gomybatis.io/assets/wx_account.jpg)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimandy%2Fgomybatis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimandy%2Fgomybatis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimandy%2Fgomybatis/lists"}