app

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2016 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PreInsertErr  = "预插入 %s 失败: %s"
	InsertErr     = "插入 %s 失败: %s"
	SelectErr     = "查询 %s 失败: %s"
	InsertSuccess = "插入 %s, 成功 %d 条"
	ClearErrMsg   = "清理 %s 失败: %s"
	UpdateSuccess = "更新 %s 成功, uid为 %s"
)
View Source
const (
	DxForum = "pre_forum_forum"
	XnForum = "bbs_forum"
)
View Source
const (
	DxPost = "pre_forum_post"
	XnPost = "bbs_post"
	Sid    = "56912b6948e57"
)
View Source
const (
	DxThread   = "pre_forum_thread"
	XnThread   = "bbs_thread"
	XnMyThread = "bbs_mythread"
)
View Source
const (
	DxUser       = "pre_common_member"
	DxUcUser     = "pre_ucenter_members"
	DxUserStatus = "pre_common_member_status"
	XnUser       = "bbs_user"
)

Variables

View Source
var (
	OldDB,
	NewDB *sql.DB
	ClearTB   = true //是否先清理表
	MergeUser = true //是否合并用户
	ResetPost = false
	//AdminUid = 1  //管理员 uid
	AdminUid string
)

数据库初始化

Functions

func ClearTable

func ClearTable(tbname string) error

*

清理 表

func FieldAddPrev

func FieldAddPrev(prev, fieldStr string) string

*

数据库加前缀

func Init

func Init()

func InputDatabase

func InputDatabase() (oldDb, newDb *sql.DB, err error)

func Ip2long

func Ip2long(ipstr string) uint32

func Long2ip

func Long2ip(ipLong uint32) string

func ToForum

func ToForum() (bool, string)

func ToPost

func ToPost() (bool, string)

*

导入 posts 表

func ToThread

func ToThread() (bool, string)

func ToUser

func ToUser() (bool, string)

Types

type DForum

type DForum struct {
	Fid     int    //版块 id
	Name    string //版块名称
	Threads int    //主题数
}

*

dx 版块表

type DPost

type DPost struct {
	Tid      int    //主题 id
	Pid      int    //帖子 id
	AuthorId int    //用户 id
	First    int    //主帖
	Dateline int    //发帖时间戳
	UseIp    string //用户 ip
	Message  string //内容
	Fid      int    //版块 id
	Subject  string //标题
}

*

dx 帖子表

type DThread

type DThread struct {
	Tid      int    //主题 id
	Fid      int    //版块 id
	AuthorId int    //发帖者id
	Subject  string //标题
	Dateline int    //发帖时间
	Lastpost int    //最后回复时间
	Views    int    //浏览数
	Replies  int    //回复数
}

*

dx 主题表

type DUser

type DUser struct {
	Uid,
	GroupId,
	RegDate int //注册时间
	Email,
	UserName,
	Password,
	Salt,
	UcPassword,
	Regip,
	Lastip string //最后登陆 ip
	Lastvisit int //最后登陆时间
}

*

pre_common_member
dx 用户表

type Forum

type Forum struct {
	Fid        int    //版块 id
	Name       string //版块名
	Threads    int    //主题数
	Brief      string //介绍
	CreateDate int    //创建时间
}

*

xn 版块表

type Hostinfo

type Hostinfo struct {
	DBUser,
	DBPassword,
	DBName,
	DBHost,
	DBPort,
	DBChar string
}

type NewUsers

type NewUsers struct {
	Uids      []int
	Emails    []string
	UserNames []string
}

按字段分组

type Post

type Post struct {
	Tid        int    //主题 id
	Pid        int    //帖子 id
	Uid        int    //用户 id
	IsFirst    int    //主帖,与 thread.firstpid 呼应
	CreateDate int    //发帖时间戳
	UserIp     int    //用户 ip ip2long()
	Sid        string //标识串
	Message    string //内容
}

*

xn 帖子表

type Thread

type Thread struct {
	Fid        int    //版块 id
	Tid        int    //主题 id
	Uid        int    //发帖者id
	UserIp     int    //发帖者 ip
	Subject    string //标题
	CreateDate int    //发帖时间
	LastDate   int    //最后回复时间
	Views      int    //浏览数
	Posts      int    //回复数
	FirstPId   int    //主题帖 id
	LastUid    int    //最后回复人
	LastPid    int    //最后回复 id
}

*

xn 主题表

type User

type User struct {
	Uid        int    //用户 id
	Gid        int    //用户组 id
	Email      string //邮箱
	UserName   string //用户名
	Password   string //密码 好像md5
	Threads    int    //主题数
	Posts      int    //回复数
	Salt       int    //加密码
	CreateIp   int    //创建 ip
	CreateDate int    //创建时间
	LoginIp    int    //登陆 ip
	LoginDate  int    //登陆日期
}

*

xn 用户表

type UserInfo

type UserInfo struct {
	Uid int
	Email,
	Username string
}

用户信息

Jump to

Keyboard shortcuts

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