goodie

package module
v0.0.0-...-620cbb7 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NotFound    = errors.New("Not Found")
	ServerError = errors.New("Internal Server Error")
)

Functions

This section is empty.

Types

type App

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

func (*App) Path

func (a *App) Path(element string) string

func (*App) Register

func (a *App) Register(page string, h NewHandler)

func (*App) SetDb

func (a *App) SetDb(db string) error

type AppHandler

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

type Handler

type Handler interface {

	// Init App.  Returns slice of urls showing stack (index -> page1 -> page2)
	// Optional, if []byte is returned, then that data is written
	Init() ([]*html.URL, []byte, error)
	RenderError(err error)
	Action(string) (*html.URL, error) // return a URL to refersh to when complete
	Header([]*html.URL)
	Display()
	Footer([]*html.URL)
	// contains filtered or unexported methods
}

type NewHandler

type NewHandler func() Handler

type Odie

type Odie struct {
	Request  *http.Request
	Response http.ResponseWriter
	Doc      *html.Document
	Body     *html.BodyElement
	Url      *html.URL
	Orm      *xorm.Engine
	Path     string // Path to applicatio's base directory
	// contains filtered or unexported fields
}

func (*Odie) Action

func (odie *Odie) Action(action string) (*html.URL, error)

Action will perform an action before the page loads. return value of url of refresh page without action query string. The allows for db updates and a page reload would not do a double action error value of nil will continue on to render. A page reload will recall action Controlled by presense of action= query string

func (*Odie) DbDelete

func (odie *Odie) DbDelete(v interface{}) error

func (*Odie) DbGet

func (odie *Odie) DbGet(id int64, v interface{}) error

func (*Odie) DbInsert

func (odie *Odie) DbInsert(v interface{}) error

func (*Odie) DbUpdate

func (odie *Odie) DbUpdate(id int64, v interface{}) error

func (*Odie) DefaultURL

func (odie *Odie) DefaultURL() *html.URL

func (*Odie) Display

func (odie *Odie) Display()

Display will show render page between header and footer

func (*Odie) Footer

func (odie *Odie) Footer(urls []*html.URL)

Footer will show the page footer

func (*Odie) GetAll

func (odie *Odie) GetAll(v interface{}) error

func (*Odie) GetOrder

func (odie *Odie) GetOrder(v interface{}, order string) error

func (*Odie) Header

func (odie *Odie) Header(urls []*html.URL)

Header will show the page header

func (*Odie) HomeURL

func (odie *Odie) HomeURL() *html.URL

func (*Odie) Init

func (odie *Odie) Init() []*html.URL

Init before page is displayed. No access to HTML at this time

func (*Odie) LoadFromQuery

func (odie *Odie) LoadFromQuery(iface interface{}) error

func (*Odie) NewForm

func (odie *Odie) NewForm(action string) *html.FormElement

func (*Odie) RenderError

func (odie *Odie) RenderError(err error)

RednerError is called anytime a fatal error is encountered

func (*Odie) SetContentType

func (odie *Odie) SetContentType(mimeType html.MimeType)

func (*Odie) ShowHeader

func (odie *Odie) ShowHeader(which string, urls []*html.URL) (*html.DivElement, *html.DivElement)

ShowHeader will return the inner div and outer div

type Server

type Server struct {
	Addr           string
	ReadTimeout    time.Duration
	WriteTimeout   time.Duration
	MaxHeaderBytes int
	// contains filtered or unexported fields
}

func Init

func Init(addr string, o *Server) *Server

func (*Server) AddFavicon

func (s *Server) AddFavicon(favicon []byte)

func (*Server) NewApp

func (s *Server) NewApp(name string) *App

func (*Server) Path

func (s *Server) Path(file string) string

func (*Server) Run

func (o *Server) Run() error

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request)

func (*Server) SetHome

func (s *Server) SetHome(home string)

Jump to

Keyboard shortcuts

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