Go-WebProject

go-webproject

Package mod_example

Overview

import "gwp/modules/mod_example"

Package mod_example shows how to write 3rd party modules which register their own handlers

Package files

mod_example.go

func LoadModule

func LoadModule() gwp_module.Module

LoadModule is a MUST for every module. It returns Module interface.

type Content

Content type is merged with template

type Content struct {
    ExampleData string
}

type ModExample

ModExample is base struct for this module. It will implement Module interface.

type ModExample struct {
    ModCtx *gwp_module.ModContext
}

M is our global module var

var M *ModExample

func (*ModExample) GetName

func (me *ModExample) GetName() string

GetName returns name of the module.

func (*ModExample) GetParams

func (me *ModExample) GetParams() *gwp_context.ModParams

GetParams returns *ModParams or nil if we don't want custom parameters in server.conf.

func (*ModExample) ModInit

func (me *ModExample) ModInit(modCtx *gwp_module.ModContext, err error)

ModInit sets the runtime ModContext for this module

func (*ModExample) SaveParams

func (me *ModExample) SaveParams(params gwp_context.ModParams)

SaveParams updates current ModContext for this module.

Build version weekly.2011-12-14 10879+.