tdb

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	CommentID  uint32
	ArticleID  string
	ArticleKey string
	UserID     string
	SiteID     string
	Content    string
	TimeStamp  time.Time
	ReplyID    sql.NullInt64
	Deleted    bool
}

Comment comment表对应的数据结构

func NewComment

func NewComment(siteID, articleKey, userEmail, content string, replyID *uint32) *Comment

NewComment 创建一个新评论的数据结构

type Mysql

type Mysql struct {
	// contains filtered or unexported fields
}

Mysql Mysql连接类

func GlobalSQLMgr

func GlobalSQLMgr() *Mysql

GlobalSQLMgr 全局数据库对象

func (*Mysql) Close

func (m *Mysql) Close()

Close 关闭数据库

func (*Mysql) GetComment

func (m *Mysql) GetComment(articleKey, siteDomain string, lastCommentID *string) ([]Comment, []User)

GetComment 通过articleKey和SiteDomain来查询评论 如果传入了lastCommentID 则返回 lastCommentID 以后的评论

func (*Mysql) GetSiteByDomain

func (m *Mysql) GetSiteByDomain(domain string) *Site

GetSiteByDomain 通过域名返回站点

func (*Mysql) GetUserByEmail

func (m *Mysql) GetUserByEmail(email string) *User

GetUserByEmail 通过email获取用户信息

func (*Mysql) GetUserByID

func (m *Mysql) GetUserByID(id string) *User

GetUserByID 通过id获取用户信息

func (*Mysql) InsertComment

func (m *Mysql) InsertComment(comm *Comment) bool

InsertComment 向数据库中插入新用户

func (*Mysql) InsertSite

func (m *Mysql) InsertSite(site *Site) bool

InsertSite 插入site数据

func (*Mysql) InsertUser

func (m *Mysql) InsertUser(user *User) bool

InsertUser 向数据库中插入新用户

type Site

type Site struct {
	SiteID     string
	SiteDomain string
	CreateTime time.Time
}

Site site表对应的数据结构

func NewSite

func NewSite(domain string) *Site

NewSite 创建一个新站点的数据结构

type User

type User struct {
	UserID      string
	Email       string
	DisplayName sql.NullString
	WebSite     sql.NullString
}

User user表对应的数据结构

func NewUser

func NewUser(email, displayName, webSite string) *User

NewUser 创建一个新用户的数据结构

Jump to

Keyboard shortcuts

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