Code Monkey home page Code Monkey logo

gas's People

Contributors

moshee avatar

Stargazers

 avatar

Watchers

 avatar

gas's Issues

Elegant solution to page load/template gen errors

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.

route: cache

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.

model: follow embedded type pointers in Selects

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.

model: add OneToMany()

A function to select an object and some owned property at the same time so that two queries don't have to be made.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.