Go-WebProject

go-webproject

Package gwp_context

Overview

import "gwp/gwp_context"

Package gwp_context defines global structures that are used throughout the project. It has to be imported by every 3rd party module.

Package files

doc.go gwp_context.go

Variables

var (
    TypeInt     uint8 = 0x01
    TypeBool    uint8 = 0x02
    TypeStr     uint8 = 0x03
    TypeFloat64 uint8 = 0x04
)

type AppConfig

AppConfig holds data parsed from configuration file, [default] and [project] sections only

type AppConfig struct {
    ListenAddr    string
    Mux           string
    ProjectRoot   string
    TempDir       string
    TemplatePath  string
    LiveTemplates bool
}

func NewAppConfig

func NewAppConfig() *AppConfig

NewAppConfig creates new instance of AppConfig, and returns pointer to it

type Context

Context is used to store all runtime app data (modules, templates, configs...)

type Context struct {
    ConfigFile string
    Router     *mux.Router
    LiveTplMsg chan *ParsedTemplate
    ErrorMsg   chan error
    App        *AppConfig
    Templates  map[string]*template.Template // keys = relative file path, vals = parsed template objects
}

func NewContext

func NewContext() *Context

NewContext creates new instance of Context, and returns pointer to it

type ModParam

Param is generic declaration of individual custom config file parameter, defined by modules

type ModParam struct {
    Name    string
    Value   interface{}
    Default interface{}
    Type    uint8
    Must    bool
}

type ModParams

type ModParams []*ModParam

type ParsedTemplate

ParsedTemplate is a wrapper type around template.Template

type ParsedTemplate struct {
    Name string
    Tpl  *template.Template
}

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