1 Star 0 Fork 0

liuxuezhan / mylib

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
CF_Register.go 1.44 KB
一键复制 编辑 原始数据 按行查看 历史
liuxuezhan 提交于 2020-10-14 10:09 . 'new mylib'
package CSV
import (
"fmt"
"sort"
"gitee.com/liuxuezhan/mylib/Utils/wsort"
)
type CF_Register_DataEntry struct {
ID int64
TimesSection string
BaseLevelSection string
WaitTime string
Reward string
}
type CF_Register struct {
BaseManager
m_kDataEntryTable map[int64]*CF_Register_DataEntry
m_kIdList []int64
}
func (this *CF_Register) Init() {
this.m_kDataEntryTable = make(map[int64]*CF_Register_DataEntry)
this.m_kIdList = make([]int64, 0)
kSqlCMD := "SELECT * FROM Register"
if data, ok := sqliteconn.Query(kSqlCMD); ok {
for i := 0; i < len(data); i++ {
kNewEntry := new(CF_Register_DataEntry)
kNewEntry.ID = ConvertToInt64(data[i]["ID"])
kNewEntry.TimesSection = data[i]["TimesSection"]
kNewEntry.BaseLevelSection = data[i]["BaseLevelSection"]
kNewEntry.WaitTime = data[i]["WaitTime"]
kNewEntry.Reward = data[i]["Reward"]
this.m_kDataEntryTable[kNewEntry.ID] = kNewEntry
this.m_kIdList = append(this.m_kIdList, kNewEntry.ID)
}
} else {
fmt.Println("Query from db3 failed!")
}
sort.Sort(wsort.Int64Slice(this.m_kIdList))
}
func (this *CF_Register) GetEntryPtr(id int64) *CF_Register_DataEntry {
if !this.ContainsID(id) {
return nil
}
return this.m_kDataEntryTable[id]
}
func (this *CF_Register) GetIDList() []int64 {
return this.m_kIdList
}
func (this *CF_Register) ContainsID(id int64) bool {
if _, ok := this.m_kDataEntryTable[id]; ok {
return true
}
return false
}
1
https://gitee.com/liuxuezhan/mylib.git
git@gitee.com:liuxuezhan/mylib.git
liuxuezhan
mylib
mylib
v1.1.3

搜索帮助