moshee / gas Goto Github PK
View Code? Open in Web Editor NEWMy personal homegrown web framework.
Home Page: http://godoc.org/ktkr.us/pkg/gas
License: BSD 3-Clause "New" or "Revised" License
My personal homegrown web framework.
Home Page: http://godoc.org/ktkr.us/pkg/gas
License: BSD 3-Clause "New" or "Revised" License
For the common pattern of a global layout with different things inside.
Perhaps by implementation of interface rather than hard-coding the users table (baaad thing).
At the moment it just panics or uses some half-assed error page handling, but there needs to be a nicer way to specify (per-site) how pages should fail gracefully and show an error page, or whatever.
Here's my preliminary bad idea.
When a router is assigned a func, it will no longer just call it. Instead, it will place it into something like this:
type CachedHandler struct {
Handler func(*Gas)
stale bool
lock *sync.RWMutex
data bytes.Buffer
}
func (self *CachedHandler) MakeStale() {
self.lock.Lock()
defer self.lock.Unlock()
self.stale = true
}
func (self *CachedHandler) Stale() bool {
self.lock.RLock()
defer self.lock.RUnlock()
return self.stale
}
func (self *CachedHandler) Handle(g *Gas) {
self.lock.RLock()
stale := self.stale
self.lock.RUnlock()
if (stale) {
// regenerate cache
}
// write response
}
...all that's left is a way to alternate between the two (arbitrarily choose) and do the full implementation, working out any race conditions and deadlocks and whatnot.
Alternatively: figure out a way to skip sync
and use channels.
If a struct type has embedded types as such:
type BlogPost struct {
Id int
Title string
Body string
*User
}
type User struct {
Id int
Name string
}
then Select
and friends should follow the embedded type in BlogPost
(on a Select
into a BlogPost
) and generate the slice of interface{}
destinations which include all of User
's fields in addition to BlogPost
's fields—five fields total, in this example: []interface{Id, Title, Body, Id, Name}
.
The function should then know where to place these values back into their corresponding embedded types.
One level of indirection should be enough for now.
A function to select an object and some owned property at the same time so that two queries don't have to be made.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.