コード例 #1
0
ファイル: wikiengine.go プロジェクト: xyproto/siteengines
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
ファイル: ipengine.go プロジェクト: xyproto/siteengines
func NewIPEngine(state pinterface.IUserState) *IPEngine {

	// Create a RedisList for storing IP adresses
	ips := simpleredis.NewList(state.Pool(), "IPs")

	ipEngine := new(IPEngine)
	ipEngine.data = ips
	ipEngine.state = state

	return ipEngine
}
コード例 #4
0
ファイル: chatengine.go プロジェクト: xyproto/siteengines
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}
}