horm

package module
v0.0.0-...-fbb9c46 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2021 License: GPL-3.0 Imports: 8 Imported by: 0

README

horm

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DBModelToFields

func DBModelToFields(dbModel DBModel) (*[]Field, error)

func RowsToFields

func RowsToFields(rows *sql.Rows) (*[]Field, error)

把rows中的数据转换成Field数组

Types

type DB

type DB interface {
	Exec(query string, args ...interface{}) (*SqliteExecResult, error)
	QueryRowInto(object interface{}, query string, args ...interface{}) error
	QueryInto(object interface{}, query string, args ...interface{}) error
	Close() error
}

type DBModel

type DBModel interface {
	TableName() string
}

type Field

type Field struct {
	TagName string
	Name    string
	Kind    reflect.Kind
	Value   interface{}
}

type FieldList

type FieldList []Field

func (*FieldList) Marshal

func (fieldList *FieldList) Marshal() ([]byte, error)

type FieldLists

type FieldLists []FieldList

func (*FieldLists) Marshal

func (fieldLists *FieldLists) Marshal() ([]byte, error)

type SqliteDB

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

func NewSqliteDB

func NewSqliteDB(dbPath string) (*SqliteDB, error)

func (*SqliteDB) Close

func (db *SqliteDB) Close() error

func (*SqliteDB) CreateTable

func (db *SqliteDB) CreateTable(model DBModel) error

func (*SqliteDB) DropTable

func (db *SqliteDB) DropTable(model DBModel) error

func (*SqliteDB) Exec

func (db *SqliteDB) Exec(query string, args ...interface{}) (*SqliteExecResult, error)

func (*SqliteDB) List

func (db *SqliteDB) List(object interface{}, query string, args ...interface{}) error

func (*SqliteDB) QueryInto

func (db *SqliteDB) QueryInto(object interface{}, query string, args ...interface{}) error

func (*SqliteDB) QueryRowInto

func (db *SqliteDB) QueryRowInto(object interface{}, query string, args ...interface{}) error

type SqliteExecResult

type SqliteExecResult struct {
	LastInsertID int64
	RowsAffected int64
}

Jump to

Keyboard shortcuts

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