Comments (2)
很高兴能够成为第一个forker、
xml文件、SQL链接 能否改成init方法初始化里
在程序的dao层直接执行方法呢
可以的,推荐使用statikFS把包含一堆的mapper.xml的文件夹一起打包成在一个static.go文件里,然后在init方法里使用
file, err := statikFS.Open("/Example_ActivityMapper.xml") bytes, _ := ioutil.ReadAll(file) var exampleActivityMapperImpl ExampleActivityMapperImpl //设置对应的mapper xml文件,因为bytes实际上就是xml的文本文件,这里也可以传[]byte(`......`) GoMybatis.UseProxyMapperByEngine(&exampleActivityMapperImpl, bytes, engine)
这样就不需要管文件在服务器上的绝对路径了。github上文件系统的框架很多的.InfluxDB 中使用了 statik 这个工具将静态资源都编译进了二进制文件中。附上教程链接http://blog.fatedier.com/2016/08/01/compile-assets-into-binary-file-with-statik-in-golang/
from gomybatis.
很高兴能够成为第一个forker、
xml文件、SQL链接 能否改成init方法初始化里
在程序的dao层直接执行方法呢
只需保证 GoMybatis.UseProxyMapperByEngine(&***)这个方法代理过你定义的struct的话,不管在什么地方使用都没关系,也不存在协程锁的问题(相当于根据xml中定义的sql规则给你的struct中包含的func写入了新的func)
from gomybatis.
Related Issues (20)
- select sql resultMap 不起作用 HOT 2
- 在使用postgres数据时出现错 HOT 11
- Error 1390: Prepared stat ement contains too many placeholders HOT 4
- <where> bug HOT 15
- 对类似rollback这样的功能怎么通过框架实现呢? HOT 1
- mapper文件中result不支持property设置? HOT 1
- 有一对多映射功能吗? HOT 20
- 多数据源如何使用 HOT 1
- 支持1对n映射了吗
- Insert方法是InsertTemplete还是InsertTemplate?
- Insert方法是InsertTemplete还是InsertTemplate?
- sql中的 #{key}获取不到
- 好久不更新了,有点不敢用啊 HOT 4
- bug
- 作者你好,打扰了 HOT 3
- 你好,数据库中null值如何解决?
- 分页插件 HOT 2
- 请问大神,使用struct传参,xml中的动态表达式能获取匿名继承的属性吗?好像不能取到 HOT 2
- 作者你好,有没有计划加入泛型的使用,mapper 和 service ,就和java的 mybatisplus 通过继承的方式一样 HOT 1
- xml与struct绑定优化建议
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gomybatis.