gobay

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2019 License: MIT Imports: 7 Imported by: 0

README

gobay

Build Status

贡献代码

如何为gobay编写extension

  1. 实现gobay.Extension
  2. 每一个ext目录都是你的例子
  3. ext读取配置的规则请参考这个issue

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

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

Application struct

func CreateApp

func CreateApp(rootPath string, env string, exts map[Key]Extension) (*Application, error)

CreateApp create an gobay Application

func (*Application) Close

func (d *Application) Close() error

Close close app when exit

func (*Application) Config

func (d *Application) Config() *viper.Viper

Config returns the viper config for this application

func (*Application) Env

func (d *Application) Env() string

func (*Application) Get

func (d *Application) Get(key Key) Extension

Get the extension at the specified key, return nil when the component doesn't exist

func (*Application) GetOK

func (d *Application) GetOK(key Key) (Extension, bool)

GetOK the extension at the specified key, return false when the component doesn't exist

func (*Application) Init

func (d *Application) Init() error

Init the application and its extensions with the config.

type Extension

type Extension interface {
	Object() interface{}
	Application() *Application
	Init(app *Application) error
	Close() error
}

Extension like db, cache

type Key

type Key string

A Key represents a key for a Extension.

Jump to

Keyboard shortcuts

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