databam

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

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

Go to latest
Published: Nov 16, 2014 License: BSD-3-Clause Imports: 7 Imported by: 2

README

DataBAM

DataBase Access Mechanism

Documentation is here for now.

If you want to take a look at it in action, try the makefile in the example directory.

License

3-clause BSD. A copy is included with the source.

Documentation

Overview

package databam is an ORM designed to make querying highly-relational datasets easy

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotAPointer      = errors.New("not a pointer")
	ErrNotMappable      = errors.New("can't map to this")
	ErrFieldUnmapped    = errors.New("couldn't map field")
	ErrIncompatibleType = errors.New("incompatible type")
)

Functions

This section is empty.

Types

type Databam

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

func New

func New(db *sql.DB) *Databam

func NewWithMapper

func NewWithMapper(db *sql.DB, mapper Mapper) *Databam

func (*Databam) Fetch

func (d *Databam) Fetch(out interface{}) error

func (*Databam) MustRepository

func (d *Databam) MustRepository(i interface{}) *Repository

func (*Databam) Repository

func (d *Databam) Repository(i interface{}) (*Repository, error)

func (*Databam) SetDebugLogger

func (d *Databam) SetDebugLogger(debugLogger DebugLogger)

type DebugLogger

type DebugLogger func(string, ...interface{})

type DefaultMapper

type DefaultMapper struct{}

func (DefaultMapper) FieldToColumn

func (m DefaultMapper) FieldToColumn(name string) string

func (DefaultMapper) FieldsFrom

func (m DefaultMapper) FieldsFrom(v reflect.Value, names []string) ([]reflect.Value, error)

func (DefaultMapper) RowTo

func (m DefaultMapper) RowTo(rows *sql.Rows, columns []string, out reflect.Value) error

func (DefaultMapper) RowsTo

func (m DefaultMapper) RowsTo(rows *sql.Rows, out interface{}) error

type Mapper

type Mapper interface {
	RowsTo(rows *sql.Rows, out interface{}) error
	RowTo(rows *sql.Rows, columns []string, out reflect.Value) error
	FieldsFrom(v reflect.Value, names []string) ([]reflect.Value, error)
	FieldToColumn(name string) string
}

type Repository

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

func NewRepository

func NewRepository(d *Databam, i interface{}) (*Repository, error)

func (Repository) Fetch

func (r Repository) Fetch(out interface{}, where interface{}) error

func (Repository) Load

func (r Repository) Load(out interface{}) error

func (*Repository) Select

func (r *Repository) Select() selectQuery

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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