orm

package module
v0.0.0-...-1c7d9d5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

README

orm

golang mysql orm

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Engine = new(MySQL)

Functions

func AddColumnSQL

func AddColumnSQL(tableName, tags string, offset ...string) string

func CreateTableSQL

func CreateTableSQL(v interface{}) string

func DropTableSQL

func DropTableSQL(v interface{}) string

func Init

func Init(dsn string) error

func ParseResult

func ParseResult(result sql.Result) string

func ParseRows

func ParseRows(rows *sql.Rows) ([]map[string]interface{}, error)

func TableName

func TableName(v interface{}) string

Types

type Interface

type Interface struct{}

type List

type List []interface{}

type Map

type Map map[string]interface{}

type MySQL

type MySQL struct {
	*sql.DB
}

func Open

func Open(driver, dsn string) (*MySQL, error)

func (*MySQL) And

func (mysql *MySQL) And(selector map[string]interface{}) string

func (*MySQL) CreateTable

func (mysql *MySQL) CreateTable(tables ...interface{}) error

func (*MySQL) Delete

func (mysql *MySQL) Delete(tableName string, selector map[string]interface{}) (sql.Result, error)

func (*MySQL) DropTable

func (mysql *MySQL) DropTable(v interface{}) (sql.Result, error)

func (*MySQL) Init

func (mysql *MySQL) Init(dsn string) (err error)

func (*MySQL) Insert

func (mysql *MySQL) Insert(tableName string, row map[string]interface{}) (sql.Result, error)

func (*MySQL) Query

func (mysql *MySQL) Query(tableName string, selector map[string]interface{}) (*sql.Rows, error)

func (*MySQL) Update

func (mysql *MySQL) Update(tableName string, selector, row map[string]interface{}) (sql.Result, error)

@tableName: 表名 @selector: 更新的条件 @row: 待更新数据

type SQL

type SQL struct {
	// contains filtered or unexported fields
}

func (*SQL) Columns

func (s *SQL) Columns(columns ...string) *SQL

func (SQL) String

func (s SQL) String() string

func (*SQL) Table

func (s *SQL) Table(table string) *SQL

func (*SQL) Where

func (s *SQL) Where(where map[string]interface{}) *SQL

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL