Skip to content

Latest commit

History

22 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

METH

M​aladroit E​lusive T​ransaction H​ub

A wrapper around upper.io/db to ease some repetitive tasks.

Reasoning Behind

Working with upper.io/db sometimes becomes a little bit repetitive, so METH is an attempt to minimize the scaffolding needed in some basic tasks [fetching by id, by certain conditions].

Badges

GoDocBuild StatusGo Report Card

Usage

Install

go get github.com/worg/meth

Any type must implement Persistent interface and return an initalized and valid db.Collection in order to use METH functions.

Example

package person
import (
"upper.io/db""upper.io/db/some_driver"
)
typePersonstruct {
IDint`db:"id"`Namestring`db:"name"`Addressstring`db:"address"`
}
var (
collection db.Collection
)
funcinit() {
//init DB and set collection
}
func (p*Person) Collection() db.Collection {
returncollection
}
func (p*Person) ById(idint) {
iferr:=meth.One(&p); err:=nil {
// handle err
}
// by this point p should've been filled with db data
}

About

Maladroit Elusive Transaction Hub

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages