Framework of data persistence for go

525 views
Skip to first unread message

Guillermo Andres Montoya Garcia

unread,
Feb 25, 2014, 3:42:40 PM2/25/14
to golan...@googlegroups.com
Hi,
Anybody know a framework of  data persistence for go language, something like  MyBatis for JAVA

Thanks

egon

unread,
Feb 26, 2014, 2:59:45 AM2/26/14
to golan...@googlegroups.com
Generally you want to avoid those, they add large amount of complexity to the project.
The questions is, what do you need it for?

If it's simple stuff, just use SQL directly. 
If you are mapping large amount of objects back and forth then you could consider mongodb.
If it's anything else then you might be structuring your program poorly.


Just to clarify, I'm not saying they are useless; I'm saying that think it through, is it something you use because of habit, because someone told you to or because you have examined all other architectural options and decided that it's the best option?


+ egon

Ben Hood

unread,
Feb 26, 2014, 3:50:27 AM2/26/14
to egon, golang-nuts
On Wed, Feb 26, 2014 at 7:59 AM, egon <egon...@gmail.com> wrote:
> Generally you want to avoid those, they add large amount of complexity to
> the project.
> The questions is, what do you need it for?

If you're considering a column store approach like Cassandra, you
might consider the approach taken by cqlc.

cqlc generates Go code from your Cassandra schema so that you can
write type safe CQL statements in Go with a natural query syntax:

http://relops.com/cqlc/

> http://www.codinghorror.com/blog/2006/06/object-relational-mapping-is-the-vietnam-of-computer-science.html

With cqlc I wanted to avoid building ORM because I didn't want to hide
the underlying storage layer from the app, I just wanted a way to
reduce boilerplate code and a way to get the Go compiler to tell me
when my app got of sync with the database schema.

Whilst cqlc library targets Cassandra CQL as a storage backend, I'm
sure that a similar paradigm could be applied to other types of
databases. To be clear, I'm not saying that cqlc will target multiple
databases, as this would break the simplicity of the library. I'm just
putting forward a "database first and leverage the Go compiler"
strategy as a generic approach.

Arstd Shang

unread,
May 28, 2017, 1:02:15 AM5/28/17
to golang-nuts
try it.  https://github.com/arstd/light 

在 2014年2月26日星期三 UTC+8上午4:42:40,Guillermo Andres Montoya Garcia写道:
Reply all
Reply to author
Forward
0 new messages