uno

package
v0.0.0-...-a39d757 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(pattern string, handler http.HandlerFunc) *server.Route

func Post

func Post(pattern string, handler http.HandlerFunc) *server.Route

Types

type Uno

type Uno struct {
	Server *server.Server
	DB     *db.DB
	Config *config.Config
	Logger log.Logger
}

UnoApi is an Uno Application for creating APIs

func Instance

func Instance() (u *Uno, err error)

Instance retuns singleton instance of our app

func New

func New() (u *Uno, err error)

New creates new Api applications

func WithConfig

func WithConfig(cfg *config.Config) (u *Uno, err error)

WithConfig Creates new Uno app with already defined config

func (*Uno) Entity

func (u *Uno) Entity(model schema.Model) *db.Session

Entity returns new database session

func (*Uno) Init

func (o *Uno) Init() error

Init initializes DB, etc

func (*Uno) RegisterModels

func (u *Uno) RegisterModels(models []schema.Model)

RegisterModels allows custom models registering that will be part of complete db Schema along with core models.

func (*Uno) RegisterRoutes

func (u *Uno) RegisterRoutes(routes []*server.Route)

func (*Uno) RegisterSeeder

func (u *Uno) RegisterSeeder(f db.DBSeeder)

RegisterSeeder keeps track aff all handler functions that we need to call with DB object, so they can all seed thir parts to the DB

func (*Uno) Run

func (u *Uno) Run()

Run executes the applications

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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