A running example of the code from:
- http://marcio.io/2015/07/handling-1-million-requests-per-minute-with-golang
- http://nesv.github.io/golang/2014/02/25/worker-queues-in-go.html
Small refactorings made to original code:
/* | |
Insert and retrieve data from mongodb with golang . | |
*/ | |
package main | |
import ( | |
"fmt" | |
"labix.org/v2/mgo" | |
// "labix.org/v2/mgo/bson" |
We tried 1 million records and results were like . | |
riak took 20 minutes | |
mongodb took 2 minutes | |
GDBM took 20 seconds | |
Level DB took 12 seconds . |
// plugin to be used for validating widgets for forms or anything with defined rules | |
/* | |
//////////////////////////////////////////////////////////////////////////////////////// | |
How to use ? | |
1) Add class = "validator" to element which has to be validated. | |
2) Add comma separated validation constraints in attribute called validator in that element like : validator="required,url" | |
(validators are defined in function called "Check_Validation" you can add more validators here .) | |
Example = <input name="url" value="http://google.com" class="validator" , validator="required,url"> |
package main | |
import ( | |
"os" | |
"encoding/xml" | |
"strings" | |
"log" | |
"runtime/debug" | |
) |
package main | |
import ( | |
"fmt" | |
"runtime" | |
"sync" | |
"github.com/davecheney/profile" | |
) | |
func main() { |
package main | |
import ( | |
"fmt" | |
) | |
func decorator(f func(s string)) func(s string) { | |
return func(s string) { | |
fmt.Println("Started") |
package main | |
import ( | |
"bytes" | |
"fmt" | |
"github.com/varver/rextro" | |
_ "golang.org/x/image/bmp" | |
_ "golang.org/x/image/webp" | |
"image" | |
_ "image/gif" |
A running example of the code from:
Small refactorings made to original code:
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"gopkg.in/mgo.v2" | |
"gopkg.in/mgo.v2/bson" | |
"log" | |
) |