package
0.0.0-20240611043310-e7e2df93f36d
Repository: https://github.com/mdaxf/iac.git
Documentation: pkg.go.dev
# Packages
Package orm provide ORM for MySQL/PostgreSQL/sqlite Simple Usage
package main
import ( "fmt" "github.com/mdaxf/iac/databases/orm" _ "github.com/go-sql-driver/mysql" // import your used driver )
// Model Struct type User struct { Id int `orm:"auto"` Name string `orm:"size(100)"` }
func init() { orm.RegisterDataBase("default", "mysql", "root:root@/my_db?charset=utf8", 30) }
func main() { o := orm.NewOrm() user := User{Name: "slene"} // insert id, err := o.Insert(&user) // update user.Name = "astaxie" num, err := o.Update(&user) // read one u := User{Id: user.Id} err = o.Read(&u) // delete num, err = o.Delete(&u) }.
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
# Variables
user:password@tcp(localhost:3306)/mydb
server=%s;port=%d;user id=%s;password=%s;database=%s
*/DatabaseConnection = "server=xxx;user id=xx;password=xxx;database=xxx" //sqlserver.
mysql,sqlserver, goracle
*/.
DB is the interface for database connection.
No description provided by the author
No description provided by the author
# Structs
No description provided by the author