orm

package module
v0.0.0-...-7f9d9a4 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2013 License: MIT Imports: 3 Imported by: 0

README

go-orm

go orm

Documentation

Index

Constants

View Source
const (
	SQL_KEY_FORMAT = `%s.%s`
	SQL_INSERT_KEY = `sql_insert_key`
	SQL_SELECT_KEY = `sql_select_key`
	SQL_GET_KEY    = `sql_get_key`
	SQL_UPDATE_KEY = `sql_update_key`
	SQL_DELETE_KEY = `sql_delete_key`
)

Variables

This section is empty.

Functions

func AddDeleteStmt

func AddDeleteStmt(namespace string, stmtFunc func(Query) *Statement)

func AddGetStmt

func AddGetStmt(namespace string, stmtFunc func(Query) *Statement)

func AddListStmt

func AddListStmt(namespace string, stmtFunc func(Query) *Statement)

func AddSaveStmt

func AddSaveStmt(namespace string, stmtFunc func(Query) *Statement)

func AddStmt

func AddStmt(namespace, sqlKey string, stmtFunc func(Query) *Statement)

func AddUpdateStmt

func AddUpdateStmt(namespace string, stmtFunc func(Query) *Statement)

func Close

func Close()

func Conn

func Conn(_db *sql.DB)

func Delete

func Delete(namespace string, query Query) (count int64, err error)

func ExecGet

func ExecGet(namespace, sqlKey string, query Query) (entity interface{}, err error)

*

  • get one entity from database

func ExecList

func ExecList(namespace, sqlKey string, query Query) (entities []interface{}, err error)

*

  • list entities from database

func ExecSave

func ExecSave(namespace, sqlKey string, query Query) (id int64, err error)

*

  • save query to database, execute insert into table command

func ExecUpdate

func ExecUpdate(namespace, sqlKey string, query Query) (count int64, err error)

*

  • save query to database, execute insert into table command

func Get

func Get(namespace string, query Query) (entity interface{}, err error)

func List

func List(namespace string, query Query) (entities []interface{}, err error)

func Save

func Save(namespace string, query Query) (id int64, err error)

func Update

func Update(namespace string, query Query) (count int64, err error)

Types

type Page

type Page struct {
	PageSize int
	StartIdx int
	EndIdx   int
	PageNum  int
}

func (*Page) SetPage

func (this *Page) SetPage(page int)

type Query

type Query interface {
}

type RowScanner

type RowScanner interface {
	Scan(dest ...interface{}) error
}

type SqlMapper

type SqlMapper struct {
	StmtMap map[string]func(Query) *Statement
}

type Statement

type Statement struct {
	Sql    string
	Scan   func(RowScanner) (interface{}, error)
	Params []interface{}
}

func MustStmt

func MustStmt(namespace, sqlKey string, query Query) *Statement

Jump to

Keyboard shortcuts

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