db

package
Version: v0.0.0-...-d144a35 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2017 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Queries .
	Queries map[string]string
)

Functions

func GetCharges

func GetCharges(db *sql.DB, roles Roles, sql string, args ...interface{})

GetCharges .

func GetDistribution

func GetDistribution(db *sql.DB, dists Dists, sql string, args ...interface{})

GetDistribution .

func GetLevels

func GetLevels(db *sql.DB, levels Levels, sql string, args ...interface{})

GetLevels .

func GetRoles

func GetRoles(db *sql.DB, roles Roles, sql string, args ...interface{})

GetRoles .

func GetTotalTimes

func GetTotalTimes(db *sql.DB, levels Levels, sql string, args ...interface{})

GetTotalTimes .

func LogRole

func LogRole(stmt *sql.Stmt, r Role)

LogRole .

func LogUser

func LogUser(stmt *sql.Stmt, r Role)

LogUser .

func Merge

func Merge(src, dst interface{}, force bool) error

Merge .

func UpdateRole

func UpdateRole(stmt *sql.Stmt, r Role)

UpdateRole .

Types

type Config

type Config struct {
	Opt   Option            `json:"db_opt"`
	Hosts map[string]string `json:"hosts"`
	DBs   map[string]Node   `json:"dbs"`
	Node  Node
	// contains filtered or unexported fields
}

Config .

type Context

type Context struct {
	*sql.DB
	Opt      Option
	QueryStr string
}

Context .

func NewContext

func NewContext(opt Option) *Context

NewContext .

type Dist

type Dist struct {
	Name  string `json:"name"`  // 名称
	Value int    `json:"value"` // 数值
}

Dist Distribution

type Dists

type Dists map[string]*Dist

Dists .

type Level

type Level struct {
	ID           string // Level_VIP
	Level        int32
	VIP          int32
	Count        int32
	CombatMin    int32
	CombatMax    int32
	CombatAvg    int32
	TotalTimeMin int32
	TotalTimeMax int32
	TotalTimeAvg int32
	CreateTime   string  // 最早创建时间
	Scale        float32 // 等级分布
}

Level Level.

func GetLevel

func GetLevel(lvls Levels, lvl, vip int32) (*Level, bool)

GetLevel .

type Levels

type Levels map[string]*Level

Levels .

type Node

type Node struct {
	Index        string
	Servers      [][]int32 `json:"servers"`
	Host         string    `json:"host"`
	StartTimeStr string    `json:"start_time"`
	StartTime    time.Time
	NowTime      time.Time
	Duration     time.Duration
	// contains filtered or unexported fields
}

Node .

type Option

type Option struct {
	User     string `json:"user" opt:"user" default:"root"`
	Password string `json:"password" opt:"password" default:"root"`
	Host     string `json:"host" opt:"host" default:"localhost"`
	Port     int    `json:"port" opt:"port" default:"3306"`
	Name     string `json:"name" opt:"name" default:"test"`
	CharSet  string `json:"char_set" opt:"charset" default:"utf8"`
}

Option .

func (Option) String

func (o Option) String() string

type Role

type Role struct {
	ID               int64  `json:"id"`                 // 角色 ID
	User             string `json:"user"`               // 用户名
	Name             string `json:"name"`               // 角色名
	Class            int32  `json:"class"`              // 职业
	Server           int32  `json:"server"`             // 区服
	Channel          string `json:"channel"`            // 渠道
	VIP              int32  `json:"vip"`                // VIP
	Charge           int32  `json:"charge"`             // 充值金额
	Level            int32  `json:"level"`              // 等级
	Combat           int32  `json:"combat"`             // 战力
	MoneyA           int32  `json:"money_a"`            // 剩余钻石
	MoneyB           int32  `json:"money_b"`            // 剩余金币
	CreateTime       int64  `json:"create_time"`        // 创建时间
	EnterTime        int64  `json:"enter_time"`         // 最后上线时间
	LeaveTime        int64  `json:"leave_time"`         // 最后下线时间
	TotalTime        int64  `json:"total_time"`         // 累计在线时长
	FirstChargeLevel int32  `json:"first_charge_level"` // 首次充值等级
	LastChargeLevel  int32  `json:"last_charge_level"`  // 最后充值等级
	FirstChargeTime  string `json:"first_charge_time"`  // 首次充值时间
	LastChargeTime   string `json:"last_charge_time"`   // 最后充值时间
	LogTimes         []int32
}

Role .

func (*Role) String

func (r *Role) String() string

type Roles

type Roles map[int64]*Role

Roles .

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL