示例#1
0
func NewWikiEngine(state pinterface.IUserState) *WikiEngine {
	pool := state.Pool()

	wikiState := new(WikiState)
	wikiState.pages = simpleredis.NewHashMap(pool, "pages")
	wikiState.pages.SelectDatabase(state.DatabaseIndex())
	wikiState.pool = pool

	return &WikiEngine{state, wikiState}
}
示例#2
0
func NewTimeTableEngine(state pinterface.IUserState) *TimeTableEngine {
	pool := state.Pool()
	timeTableState := new(TimeTableState)

	timeTableState.plans = simpleredis.NewHashMap(pool, "plans")
	timeTableState.plans.SelectDatabase(state.DatabaseIndex())

	timeTableState.pool = pool
	return &TimeTableEngine{state, timeTableState}
}
示例#3
0
func NewChatEngine(userState pinterface.IUserState) *ChatEngine {
	pool := userState.Pool()
	dbindex := userState.DatabaseIndex()

	chatState := new(ChatState)

	chatState.active = pinterface.NewSet(pool, "active")
	chatState.active.SelectDatabase(dbindex)

	chatState.said = pinterface.NewList(pool, "said")
	chatState.said.SelectDatabase(dbindex)

	chatState.userInfo = pinterface.NewHashMap(pool, "userInfo") // lastSeen.time is an encoded timestamp for when the user was last seen chatting
	chatState.userInfo.SelectDatabase(dbindex)

	chatState.pool = pool
	return &ChatEngine{userState, chatState}
}