🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

github.com/cordova2009/go-mysql-orm

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/cordova2009/go-mysql-orm

v0.0.0-20211206080621-532c386ee131
Version published
Created

go-mysql-orm

Go-mysql-orm is a simple mysql ORM for Go.

Drivers Support

Drivers for Go's sql package which currently support database/sql includes:

Installation

go get github.com/cordova2009/go-mysql-orm

Quick Start

  • Create Engine
engine, err := mysql.New(driverName, dataSourceName)
  • Define a struct
type User struct {
Id int64
Name string
Age int
}

  • Query

users, err := mysql.Query("select * from user")

user, err := mysql.Query("select * from user where Id=?", id)

  • Save
user := new(User)
user.Id = 899
user.Name = "zhangsan"
user.Age = 18
_, err := mysql.Save(user)


  • Update
user := new(User)

user.Name = "zhangsan"
user.Age = 20
_, err := mysql.Update(user, "Id", 899)


FAQs

Package last updated on 06 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts