Categorygithub.com/najeira/sql
modulepackage
1.0.2
Repository: https://github.com/najeira/sql.git
Documentation: pkg.go.dev

# README

sql

A useful package of SQL.

This library wraps standard database/sql package and provides some utilities.

Usage

import "github.com/najeira/sql"

func main() {
    // open
    db, err := sql.Open(sql.Config{
        User:       "sqltest",
        Passwd:     "testsql",
        ServerName: "localhost:3306",
        DBName:     "sqltest",
    })
    if err != nil {
        panic(err)
    }
    
    // select
    ctx := context.Background()
    var rows []*struct{
        ID int64 `db:"id"`
        Name string `db:"name"`
    }
    q := "SELECT id, name FROM users"
    res, err := db.Select(ctx, &rows, q)
    if err != nil {
        panic(err)
    }
}

# Functions

Error number: 1062 Symbol: ER_DUP_ENTRY SQLSTATE: 23000 Message: Duplicate entry '%s' for key %d.
Error number: 1452 Symbol: ER_NO_REFERENCED_ROW_2 SQLSTATE: 23000 Message: Cannot add or update a child row: a foreign key constraint fails (%s).
Error number: 3572 Symbol: ER_LOCK_NOWAIT SQLSTATE: HY000 Message: Statement aborted because lock(s) could not be acquired immediately and NOWAIT is set.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author