ecomapp

package module
v0.0.0-...-3e22d2e Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2020 License: MIT Imports: 16 Imported by: 0

README

go-ecom-app

E-commerce application object

This is the foundation of go-ecom. This is where it all glues together.

In the application object the sub-systems are loaded and initialized. The application object also provides a database object as well as the hook messaging system.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	DB            *ecomdb.DBConnector
	Hooks         map[string][]Hook
	SystemModules []Module
	UserModules   []Module
	Router        *gin.Engine
	URIHandler    *urihandler.URIHandler
}

Application - Struct that defines the application

func NewApplication

func NewApplication() *Application

NewApplication - Create a new application object

func (*Application) CallHook

func (app *Application) CallHook(name string, payload interface{}) (bool, bool, error)

CallHook - Call and handle hokks by the given name and execute them with the supplied payload

func (*Application) Done

func (app *Application) Done()

Done - Uninitialize the system

func (*Application) Init

func (app *Application) Init()

Init - Here the system will initialize all its main components.

func (*Application) ListenToHook

func (app *Application) ListenToHook(name string, callback func(interface{}) (bool, error))

ListenToHook - Register a hook listener by name and with its callback function

func (*Application) LoadPlugins

func (app *Application) LoadPlugins(path string, modules *[]Module)

LoadPlugins - Load all plugins from the given path and add them to the supplied list of modules

func (*Application) Ping

func (app *Application) Ping() string

Ping - A plain Ping/Pong to check if there still are life on Mars

func (*Application) Run

func (app *Application) Run()

Run - This is the main part of the system. From here everything will be run.

func (*Application) SysInit

func (app *Application) SysInit()

SysInit - This is a form of pre-init that will warm up the system, load all plugins and make some pre-initializations

func (*Application) UseBasicAuth

func (app *Application) UseBasicAuth(contextName string) *BasicAuth

UseBasicAuth - Middleware registratio function for using basic authentication

type BasicAuth

type BasicAuth struct {
	App         *Application
	ContextName string
}

func (*BasicAuth) Use

func (basic *BasicAuth) Use() gin.HandlerFunc

type Hook

type Hook struct {
	Callback func(interface{}) (bool, error)
}

Hook - Struct to define a hook

type HookCallback

type HookCallback func(*func(interface{}) (bool, error)) (bool, error)

HookCallback - type definition for a HookCallback

type Module

type Module struct {
	SysInit  func(app *Application) error
	Init     func(app *Application) error
	Done     func(app *Application) error
	Plugin   *plugin.Plugin
	Filename string
}

Module - Struct that defined a module (plugin)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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