Discover Packages
github.com/kristofer/gooo
command
module
Version:
v0.0.0-...-65a2e11
Opens a new window with list of versions in this module.
Published: Jan 20, 2013
License: MIT
Opens a new window with license information.
Imports: 7
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
README
¶
Gooo
_____
/ ____|
| | __ ___ ___ ___
| | |_ |/ _ \ / _ \ / _ \
| |__| | (_) | (_) | (_) |
\_____|\___/ \___/ \___/
Pronunciation: /ɡoʊʊʊ/
Go lang web app "framework" showcasing straightforward, no-magic, web development with the Go language . Includes batch template processing and interaction with postgresql databases, and Model-View architecture.
Philosophy
Anti-magic
So simple, that it's complex.
So complex, that it works.
If it doesn't work, publish it.
Modular architecture
model
struct
type
no special tags or fields, models are just Go structs
business logic - straightforward DB methods to be used in the view module
view
parses templates in tmpl/
folder and defines how they are rendered
uses html/template
to parse and render
fetches rows from database as type Model interfaces
router
handles dynamic and static routes, request methods, main handler matches the request URL against the routes
middleware filters for restful routes
introspection
models implement interface{}
and []interface{}
types
Go's dynamic feature is interface type conversion, generally checked at runtime
Interface -> JSON interface{} -> []byte
Interface -> Struct []interface{}
-> map[string]interface{}
GetStructValues interface{} -> []interface{}
InterfaceName: interface{} -> string
util
generic error handler HandlerErr(err error)
Tested and approved by Typeunsafe© Corporation
Tell me more...
Why Go?
Is it good?
Are you good?
Let's Gooo test the example blog app
resolve dependencies
go get https://github.com/bmizerany/pq (pure Go postgres driver for database/sql
)
don't want to use postgresql? Use it anyway.
Sign up for a free Heroku Postgres account here .
Create a database and save the connection params for the next step.
configure the database connection variable dpParams
in the model package (model/model.go
)
go install
iff first build
go build && ./gooo
http://localhost:8080
Gooo celebrate
Gooo outside
Let's Gooo write your own Gooo app
resolve dependencies
go get https://github.com/bmizerany/pq (pure Go postgres driver for database/sql
)
don't want to use postgresql? Use it anyway.
Sign up for a free Heroku Postgres account here .
Create a database and save the connection params for the next step.
define your model interfaces and configure the database connection in the model package (model/model.go
)
implement your model interface types with anonymous BaseModel
field
use `json:"-"`
for type safety and Go lang future proofing
implement functions and variables available to all models with anonymous BaseModel
field in the Model
interface type
define your views as request handler functions in the view package (view/view.go
)
write your templates in tmpl/
(Go text/template syntax )
define routes in main package gooo.go
go install
iff first build
go build && ./gooo
http://localhost:8080
Gooo celebrate
Gooo outside
Gooo read these
Enjoy,
- Aaron Lifton
Expand ▾
Collapse ▴
Documentation
¶
There is no documentation for this package.
Source Files
¶
Directories
¶
Click to show internal directories.
Click to hide internal directories.