larago

package module
v0.0.0-...-4b56e16 Latest Latest
Warning

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

Go to latest
Published: May 11, 2017 License: MIT Imports: 7 Imported by: 0

README

LaraGo Framework

Go framework for those, who are switching from PHP and the marvellous Laravel Framework.

See it in action you can in the application boilerplate.

Documentation

Index

Constants

View Source
const (
	// HomeDirectory default path to application home directory.
	HomeDirectory = "/var/lib/larago"

	// DateTimeFormat default date-time format.
	DateTimeFormat = "2006-01-02 15:04:05"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	*container.Container

	Version        string
	Name           string
	Description    string
	HomeDirectory  string
	DateTimeFormat string
	// contains filtered or unexported fields
}

Application struct.

func New

func New() *Application

New constructor of the application.

func (*Application) Boot

func (app *Application) Boot() error

Boot Application.

func (*Application) BootstrapWith

func (app *Application) BootstrapWith(boostrappers ...Bootstrapper) error

BootstrapWith runs bootstrappers one by one to populate and prepare application.

func (*Application) Commands

func (app *Application) Commands(commands ...ConsoleCommand)

Commands registers commands.

func (*Application) Config

func (app *Application) Config() *ConfigRepository

Config getter.

func (*Application) Env

func (app *Application) Env(name string) bool

Env checks if application works in this environment.

func (*Application) Facade

func (app *Application) Facade(wrappers ...*Facade)

Facade registers application facades.

func (*Application) GetCommands

func (app *Application) GetCommands() []ConsoleCommand

GetCommands retrieve registered console commands.

func (*Application) ImportConfig

func (app *Application) ImportConfig() *Application

ImportConfig of the application.

func (*Application) Register

func (app *Application) Register(providers ...ServiceProvider)

Register service.

func (*Application) ResolveTag

func (app *Application) ResolveTag(tag string, container *container.Container) interface{}

ResolveTag resolves custom tags.

func (*Application) Run

func (app *Application) Run()

Run application.

func (*Application) SetConfig

func (app *Application) SetConfig(loader ConfigLoader) *Application

SetConfig callback that loads config while bootstrapping.

type Bootstrapper

type Bootstrapper func(application *Application) error

Bootstrapper function.

type Config

type Config interface {
	// Env returns current environment name.
	Env() string

	// Debug returs debug mode state.
	Debug() bool
}

Config interface.

type ConfigLoader

type ConfigLoader func() Config

ConfigLoader is a callback function for lazy loading application config.

type ConfigRepository

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

ConfigRepository used to store and get access to application config vars.

func (*ConfigRepository) Debug

func (c *ConfigRepository) Debug() bool

Debug returs debug mode state.

func (*ConfigRepository) Env

func (c *ConfigRepository) Env() string

Env returns current environment name.

func (*ConfigRepository) Get

func (c *ConfigRepository) Get(key string) interface{}

Get value from config using dot-notation.

func (*ConfigRepository) Set

func (c *ConfigRepository) Set(key string, value interface{})

Set value to config using dot-notation.

type ConsoleCommand

type ConsoleCommand interface {
	// GetCommand for the cli to register.
	GetCommand() cli.Command

	// Handle command.
	Handle(args cli.Args) error
}

ConsoleCommand interface.

type ExitHandler

type ExitHandler interface {
	// Exit application gracefully with message and code.
	Exit(message string, exitCode int)

	// Defer handles panics.
	Defer()
}

ExitHandler provides interface to handle application exits and panic throws.

type Facade

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

Facade struct.

func (*Facade) Clear

func (f *Facade) Clear()

Clear resolved facade.

func (*Facade) Resolve

func (f *Facade) Resolve(accessor interface{}) interface{}

Resolve instance.

type Kernel

type Kernel interface {
	// Handle console command.
	Handle()

	// SetBootstrappers sets Application bootstrappers.
	SetBootstrappers(bootstrappers ...Bootstrapper)
}

Kernel interface.

type ServiceProvider

type ServiceProvider interface {
	// Register service.
	Register(application *Application)
}

ServiceProvider interface.

type SignalsHandler

type SignalsHandler interface {
	// CatchInterrupt handles sigterm.
	CatchInterrupt()
}

SignalsHandler provides interface to handle system signals.

Jump to

Keyboard shortcuts

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