this not strictly related to your package, but as i m struggling too with DB management, just sharing.
I m user of dbr, another orm like package, like yours it helps to deal with the db, and reduce its size. Both packages provide a way to execute sql queries more easily. None of the packages helps me to maintain the schema over time, I don t mean deployment here, i mean schema maintenance within the code (table, columns names within strings ect) I miss a package where i could write something like db.InsertInto(Persons.TableName).Columns(Persons.InsertFields()) db.Select(Persons.TableName) .Join(Persons.Jobs) .Where(Persons.Age.Gt(15)).Where(Persons.Name.Like("%whatever"")) Doing so i could spread the schema anywhere in the app, at compile time it could tell if a query will fail for schema related problem. On Sunday, March 5, 2017 at 6:25:29 AM UTC+1, jmacwhyte wrote: > > Hello all, > > After seeing a need for simplifying SQL databases in Go, I have written a > new package that makes it very easy to do basic SELECT, INSERT, and UPDATE > database operations. Essentially you define a struct that corresponds with > the data in your database, and then you can simply pass that struct to my > package to insert and retrieve data. I'm now using it in one of my > projects, and it has reduced database-related code by 60%, making things > much more readable! > > Here's how easy it is to retrieve some info, make some changes, and return > it to the database: > > type SumoWreslter struct { > Name string `db:"name"` > Age int `db:"age"` > Rank string `db:"level"` > } > > func main() { > db, err := sqlez.Open("databaseDriver", "dataSource") > > tooOld := 30 > > results, err := db.SelectFrom("wrestlers", SumoWreslter{}, sqlez.Params{ > Where: `age < ? AND level = "master"`, > OrderBy: `age DESC`, > Limit: 1, > }, tooOld) > > theOne := results[0].(SumoWreslter) > theOne.Rank = "grand master" > // Manipulate data further > > _, err := db.Update("wrestlers", theOne, sqlez.Params{ > Where: `name = ?`, > }, theOne.Name) > } > > // Done! > > I think it's a very handy tool, especially for getting started quickly. It > can handle embedded structs, it can store and retrieve Go datatypes like > structs and maps using JSON, and uses sql.NullString under the hood to > avoid errors when trying to pull TEXT columns that are NILL. > > I would love any feedback or suggestions, both on the code and the > documentation I've written (which is geared more for people who are new-ish > to Go). > > Thanks! > James > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.