var GlobalSessions *session.Manager
func test(){
sess, _ := GlobalSessions.SessionStart(c.Ctx.ResponseWriter, c.Ctx.Request)
}
func main() {
var globalSessions, _ = session.NewManager("memory", conf)
go globalSessions.GC()
admin.GlobalSessions = globalSessions
}
syntax = "proto3";
package entity;
message Entity {
// Kinds:
//
// * kaboom
// * oops
string kind = 1;
message Kaboom { uint64 data = 1; }
message Oops { uint64 data = 1; }
Kaboom kaboom = 2;
Oops oops = 3;
}
package main
import (
"github.com/golang/protobuf/proto"
"pathtopkg/entity"
)
func main() {
var e entity.Entity
err := proto.Unmarshal(buf, &e)
if err != nil {
panic(err)
}
switch e.Kind {
case "kaboom":
// Kaboom
case "oops":
// Oops
default:
panic("Invalid kind")
}
}