mirror of
https://github.com/hanzoai/sqlbuilder.git
synced 2026-10-01 00:37:42 +00:00
add coverage report
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
[](https://travis-ci.org/huandu/go-sqlbuilder)
|
||||
[](https://godoc.org/github.com/huandu/go-sqlbuilder)
|
||||
[](https://goreportcard.com/report/github.com/huandu/go-sqlbuilder)
|
||||
[](https://coveralls.io/github/huandu/go-sqlbuilder?branch=master)
|
||||
|
||||
Package `sqlbuilder` provides a set of flexible and powerful SQL string builders. The only goal of this package is to build SQL string with arguments which can be used in `DB#Query` or `DB#Exec` defined in package `database/sql`.
|
||||
|
||||
@@ -41,8 +42,8 @@ Following builders are implemented right now. API document and examples are prov
|
||||
* [InsertBuilder](https://godoc.org/github.com/huandu/go-sqlbuilder#InsertBuilder): Builder for INSERT.
|
||||
* [UpdateBuilder](https://godoc.org/github.com/huandu/go-sqlbuilder#UpdateBuilder): Builder for UPDATE.
|
||||
* [DeleteBuilder](https://godoc.org/github.com/huandu/go-sqlbuilder#DeleteBuilder): Builder for DELETE.
|
||||
* [Build](https://godoc.org/github.com/huandu/go-sqlbuilder#Build): Freestyle builder using `fmt.Sprintf`-like syntax.
|
||||
* [Buildf](https://godoc.org/github.com/huandu/go-sqlbuilder#Buildf): Advanced freestyle builder using special syntax defined in [Args#Compile](https://godoc.org/github.com/huandu/go-sqlbuilder#Args.Compile).
|
||||
* [Buildf](https://godoc.org/github.com/huandu/go-sqlbuilder#Buildf): Freestyle builder using `fmt.Sprintf`-like syntax.
|
||||
* [Build](https://godoc.org/github.com/huandu/go-sqlbuilder#Build): Advanced freestyle builder using special syntax defined in [Args#Compile](https://godoc.org/github.com/huandu/go-sqlbuilder#Args.Compile).
|
||||
|
||||
### Using `Struct` as a light weight ORM ###
|
||||
|
||||
|
||||
@@ -308,6 +308,7 @@ func ExampleStruct_useTag() {
|
||||
var order Order
|
||||
sql, args := orderStruct.SelectFromForTag(table, tag).Where("id = 1234").Build()
|
||||
rows, _ := db.Query(sql, args...)
|
||||
defer rows.Close()
|
||||
rows.Scan(orderStruct.AddrForTag(tag, &order)...)
|
||||
|
||||
// Discount for this user.
|
||||
@@ -328,6 +329,7 @@ func ExampleStruct_useTag() {
|
||||
var order Order
|
||||
sql, args := orderStruct.SelectFromForTag(table, tag).Where("id = 1234").Build()
|
||||
rows, _ := db.Query(sql, args...)
|
||||
defer rows.Close()
|
||||
rows.Scan(orderStruct.AddrForTag(tag, &order)...)
|
||||
|
||||
// Update state to paid when user has paid for the order.
|
||||
|
||||
Reference in New Issue
Block a user