Sqlx: SQL builder

Created on 8 Sep 2017  路  1Comment  路  Source: jmoiron/sqlx

Have you thought about SQL builder ?
eg:
image
A great many possibilities

Most helpful comment

@zxysilent, I recommend you to take a look at https://github.com/Masterminds/squirrel. I'm using it currently for my project. It's quite simple:

func Select(cols string, destination interface{}, where sq.Eq, db *sqlx.DB) error {
  // build query using squirrel
  query, args, _ := sq.Select(cols).From(Table).Where(where).ToSql()

 // Run query using sqlx
  return db.Get(destination, query, args...)
}

>All comments

@zxysilent, I recommend you to take a look at https://github.com/Masterminds/squirrel. I'm using it currently for my project. It's quite simple:

func Select(cols string, destination interface{}, where sq.Eq, db *sqlx.DB) error {
  // build query using squirrel
  query, args, _ := sq.Select(cols).From(Table).Where(where).ToSql()

 // Run query using sqlx
  return db.Get(destination, query, args...)
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

x1unix picture x1unix  路  4Comments

davisford picture davisford  路  5Comments

railsmechanic picture railsmechanic  路  5Comments

plandem picture plandem  路  5Comments

fpolli picture fpolli  路  5Comments