当前位置: 首页>>代码示例>>Golang>>正文


Golang store.DBConn类代码示例

本文整理汇总了Golang中github.com/bboozzoo/q3stats/store.DBConn的典型用法代码示例。如果您正苦于以下问题:Golang DBConn类的具体用法?Golang DBConn怎么用?Golang DBConn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DBConn类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: NewWeaponStat

// create new weapon stat and return its ID
func NewWeaponStat(store store.DBConn, ws WeaponStat) uint {
	db := store.Conn()

	db.Create(&ws)

	return ws.ID
}
开发者ID:bboozzoo,项目名称:q3stats,代码行数:8,代码来源:weapon.go

示例2: NewItemStat

// create new item stat and return its ID
func NewItemStat(store store.DBConn, is ItemStat) uint {
	db := store.Conn()

	db.Create(&is)

	return is.ID
}
开发者ID:bboozzoo,项目名称:q3stats,代码行数:8,代码来源:item.go

示例3: NewPlayerMatchStat

func NewPlayerMatchStat(store store.DBConn, pms PlayerMatchStat) uint {
	db := store.Conn()

	db.Create(&pms)

	return pms.ID
}
开发者ID:bboozzoo,项目名称:q3stats,代码行数:7,代码来源:playermatch.go

示例4: NewAliasOrCurrent

// create or lookup a matching alias and return its ID
func NewAliasOrCurrent(store store.DBConn, newalias Alias) uint {
	db := store.Conn()

	var alias Alias
	db.FirstOrCreate(&alias, newalias)

	return alias.ID
}
开发者ID:bboozzoo,项目名称:q3stats,代码行数:9,代码来源:alias.go

示例5: ListPlayers

func ListPlayers(store store.DBConn) []Player {
	db := store.Conn()

	var players []Player
	db.Find(&players)

	return players
}
开发者ID:bboozzoo,项目名称:q3stats,代码行数:8,代码来源:player.go

示例6: NewMatch

// create new match and return its ID
func NewMatch(store store.DBConn, match Match) uint {

	db := store.Conn()

	db.Create(&match)

	return match.ID
}
开发者ID:bboozzoo,项目名称:q3stats,代码行数:9,代码来源:match.go

示例7: GetAliases

// return alphabetically ordered list of aliases
func GetAliases(store store.DBConn, user uint) []Alias {
	var aliases []Alias
	store.Conn().
		Model(&Alias{}).
		Where("player_id = ?", user).
		Order("alias").
		Find(&aliases)

	return aliases
}
开发者ID:bboozzoo,项目名称:q3stats,代码行数:11,代码来源:alias.go

示例8: GetAlias

// find alias using alias ID
func GetAlias(store store.DBConn, aliasID uint) *Alias {
	db := store.Conn()

	var alias Alias
	nf := db.First(&alias, aliasID).RecordNotFound()
	if nf == true {
		return nil
	}
	return &alias
}
开发者ID:bboozzoo,项目名称:q3stats,代码行数:11,代码来源:alias.go

示例9: ListWeaponStats

// list weapon statistics for given player match stat ID
func ListWeaponStats(store store.DBConn, pmsID uint) []WeaponStat {
	db := store.Conn()

	var ws []WeaponStat
	db.Where(&WeaponStat{
		PlayerMatchStatID: pmsID,
	}).Find(&ws)

	return ws
}
开发者ID:bboozzoo,项目名称:q3stats,代码行数:11,代码来源:weapon.go

示例10: ListItemStats

// list weapon statistics for given player match stat ID
func ListItemStats(store store.DBConn, pmsID uint) []ItemStat {
	db := store.Conn()

	var is []ItemStat
	db.Where(&ItemStat{
		PlayerMatchStatID: pmsID,
	}).Find(&is)

	return is
}
开发者ID:bboozzoo,项目名称:q3stats,代码行数:11,代码来源:item.go

示例11: ListPlayerMatchStat

func ListPlayerMatchStat(store store.DBConn, matchID uint) []PlayerMatchStat {
	db := store.Conn()

	// locate all players in this match
	var pls []PlayerMatchStat

	db.Where(&PlayerMatchStat{MatchID: matchID}).
		Find(&pls)

	return pls
}
开发者ID:bboozzoo,项目名称:q3stats,代码行数:11,代码来源:playermatch.go

示例12: NewPlayer

// create new player returning its ID
func NewPlayer(store store.DBConn, name string, passwordhash string) uint {
	player := Player{
		Name:         name,
		PasswordHash: passwordhash,
	}

	db := store.Conn()

	db.Create(&player)

	return player.ID
}
开发者ID:bboozzoo,项目名称:q3stats,代码行数:13,代码来源:player.go

示例13: GetPlayer

func GetPlayer(store store.DBConn, pid uint) *Player {
	db := store.Conn()

	var player Player

	notfound := db.First(&player, pid).
		RecordNotFound()
	if notfound == true {
		return nil
	}
	return &player
}
开发者ID:bboozzoo,项目名称:q3stats,代码行数:12,代码来源:player.go

示例14: FindMatchByHash

func FindMatchByHash(store store.DBConn, hash string) *Match {

	db := store.Conn()

	var mfound Match
	notfound := db.Where("data_hash = ?", hash).
		Find(&mfound).
		RecordNotFound()
	if notfound == true {
		return nil
	}
	return &mfound
}
开发者ID:bboozzoo,项目名称:q3stats,代码行数:13,代码来源:match.go

示例15: ClaimAliasesByPlayer

func ClaimAliasesByPlayer(store store.DBConn, player uint, aliases []string) {
	// update aliases set player_id = `player` where aliases in
	// `aliases`?

	db := store.Conn()

	tx := db.Begin()
	for _, a := range aliases {
		tx.Model(&Alias{}).
			Where(&Alias{Alias: a}).
			Update("player_id", player)
	}
	tx.Commit()
}
开发者ID:bboozzoo,项目名称:q3stats,代码行数:14,代码来源:alias.go


注:本文中的github.com/bboozzoo/q3stats/store.DBConn类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。