Giter Club home page Giter Club logo

Comments (2)

zhuxiujia avatar zhuxiujia commented on June 30, 2024

很高兴能够成为第一个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.

zhuxiujia avatar zhuxiujia commented on June 30, 2024

很高兴能够成为第一个forker、

xml文件、SQL链接 能否改成init方法初始化里

在程序的dao层直接执行方法呢

只需保证 GoMybatis.UseProxyMapperByEngine(&***)这个方法代理过你定义的struct的话,不管在什么地方使用都没关系,也不存在协程锁的问题(相当于根据xml中定义的sql规则给你的struct中包含的func写入了新的func)

from gomybatis.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.