Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
gorp
✓ github.com/go-gorp/gorp/v3
Creates a table and inserts a record using Gorp.
package main
import (
"database/sql"
"fmt"
"github.com/go-gorp/gorp/v3"
_ "github.com/mattn/go-sqlite3"
)
type Person struct {
Id int `db:"id"`
Name string `db:"name"`
}
func main() {
db, _ := sql.Open("sqlite3", ":memory:")
dbmap := &gorp.DbMap{Db: db, Dialect: gorp.SqliteDialect{}}
dbmap.AddTableWithName(Person{}, "people").SetKeys(true, "Id")
dbmap.CreateTables()
err := dbmap.Insert(&Person{Name: "Alice"})
fmt.Println(err)
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
3.1.0latest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.