github.com/technosophos/structable (go): Structable makes a loose distinction between a Record (a description of the data to be stored) and a Recorder (the thing that does the storing). A Record is a simple annotated struct that describes the properties of an object.  Structable provides the Recorder (an interface usually backed by a *DbRecorder). The Recorder is capable of doing the following:  Structable is pragmatic in the sense that it allows ActiveRecord-like extension of the Record object to allow business logic. A Record does not *have* to be a simple data-only struct. It can have methods -- even methods that operate on the database.  Importantly, Structable does not do any relation management. There is no magic to convert structs, arrays, or maps to references to other tables. (If you want that, you may prefer GORM or GORP.) The preferred method of handling relations is to attach additional methods to the Record struct.  Structable uses Squirrel for statement building, and you may also use Squirrel for working with your data.  The following example is taken from the `example/users.go` file.  The above pattern closely binds the Recorder to the Record. Essentially, in this usage Structable works like an ActiveRecord.  It is also possible to emulate a DAO-type model and use the Recorder as a data access object and the Record as the data description object. An example of this method can be found in the `example/fence.go` code.  The `stbl` tag is of the form:  The field name is passed verbatim to the database. So `fieldName` will go to the database as `fieldName`. Structable is not at all opinionated about how you name your tables or fields. Some databases are, though, so you may need to be careful about your own naming conventions.  `PRIMARY_KEY` tells Structable that this field is (one of the pieces of) the primary key. Aliases: 'PRIMARY KEY'  `AUTO_INCREMENT` tells Structable that this field is created by the database, and should never be assigned during an Insert(). Aliases: SERIAL, AUTO INCREMENT  Things Structable doesn't do (by design)  However, Squirrel can ease many of these tasks.
Keywords: go|squirrel