mysql_dao

package
v0.0.0-...-e41513e Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommonDAO

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

func NewCommonDAO

func NewCommonDAO(db *sqlx.DB) *CommonDAO

func (*CommonDAO) CheckExists

func (dao *CommonDAO) CheckExists(table string, params map[string]interface{}) bool

检查是否存在 TODO(@benqi): SELECT count(id) 是否会快一点?

type UserPasswordsDAO

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

func NewUserPasswordsDAO

func NewUserPasswordsDAO(db *sqlx.DB) *UserPasswordsDAO

func (*UserPasswordsDAO) Insert

insert into user_passwords(user_id, server_salt, hash, salt, hint, email, state) values (:user_id, :server_salt, ”, ”, ”, ”, 0) TODO(@benqi): sqlmap

func (*UserPasswordsDAO) SelectByUserId

func (dao *UserPasswordsDAO) SelectByUserId(user_id int32) *dataobject.UserPasswordsDO

select user_id, server_salt, hash, salt, hint, email, state from user_passwords where user_id = :user_id limit 1 TODO(@benqi): sqlmap

func (*UserPasswordsDAO) SelectCode

func (dao *UserPasswordsDAO) SelectCode(user_id int32) *dataobject.UserPasswordsDO

select code, code_expired, attempts from user_passwords where user_id = :user_id limit 1 TODO(@benqi): sqlmap

func (*UserPasswordsDAO) Update

func (dao *UserPasswordsDAO) Update(salt string, hash string, hint string, email string, state int8, user_id int32) int64

update user_passwords set salt = :salt, hash = :hash, hint = :hint, email = :email, state = :state where user_id = :user_id TODO(@benqi): sqlmap

type UserPresencesDAO

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

func NewUserPresencesDAO

func NewUserPresencesDAO(db *sqlx.DB) *UserPresencesDAO

func (*UserPresencesDAO) Insert

insert into user_presences(user_id, last_seen_at, last_seen_auth_key_id, created_at) values (:user_id, :last_seen_at, :last_seen_auth_key_id, :created_at) TODO(@benqi): sqlmap

func (*UserPresencesDAO) SelectByUserID

func (dao *UserPresencesDAO) SelectByUserID(user_id int32) *dataobject.UserPresencesDO

select last_seen_at from user_presences where user_id = :user_id TODO(@benqi): sqlmap

func (*UserPresencesDAO) SelectByUserIDList

func (dao *UserPresencesDAO) SelectByUserIDList(idList []int32) *dataobject.UserPresencesDO

select user_id, last_seen_at from user_presences where user_id in (:idList) order by user_id asc TODO(@benqi): sqlmap

func (*UserPresencesDAO) UpdateLastSeen

func (dao *UserPresencesDAO) UpdateLastSeen(last_seen_at int64, last_seen_auth_key_id int64, user_id int32) int64

update user_presences set last_seen_at = :last_seen_at, last_seen_auth_key_id = :last_seen_auth_key_id, version = version + 1 where user_id = :user_id TODO(@benqi): sqlmap

type UserPrivacysDAO

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

func NewUserPrivacysDAO

func NewUserPrivacysDAO(db *sqlx.DB) *UserPrivacysDAO

func (*UserPrivacysDAO) Insert

insert into user_privacys(user_id, key_type, rules) values (:user_id, :key_type, :rules) TODO(@benqi): sqlmap

func (*UserPrivacysDAO) SelectPrivacy

func (dao *UserPrivacysDAO) SelectPrivacy(user_id int32, key_type int8) *dataobject.UserPrivacysDO

select id, user_id, key_type, rules from user_privacys where user_id = :user_id and key_type = :key_type TODO(@benqi): sqlmap

func (*UserPrivacysDAO) UpdatePrivacy

func (dao *UserPrivacysDAO) UpdatePrivacy(rules string, user_id int32, key_type int8) int64

update user_privacys set rules = :rules where user_id = :user_id and :key_type TODO(@benqi): sqlmap

type UsersDAO

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

func NewUsersDAO

func NewUsersDAO(db *sqlx.DB) *UsersDAO

func (*UsersDAO) Banned

func (dao *UsersDAO) Banned(banned int64, banned_reason string, banned_at string, id int32) int64

update users set banned = :banned, banned_reason = :banned_reason, banned_at = :banned_at where id = :id TODO(@benqi): sqlmap

func (*UsersDAO) Delete

func (dao *UsersDAO) Delete(deleted_reason string, deleted_at string, id int32) int64

update users set deleted = 1, deleted_reason = :deleted_reason, deleted_at = :deleted_at where id = :id TODO(@benqi): sqlmap

func (*UsersDAO) Insert

func (dao *UsersDAO) Insert(do *dataobject.UsersDO) int64

insert into users(first_name, last_name, access_hash, username, phone, country_code, bio, about, is_bot) values (:first_name, :last_name, :access_hash, :username, :phone, :country_code, :bio, :about, :is_bot) TODO(@benqi): sqlmap

func (*UsersDAO) SearchByQueryNotIdList

func (dao *UsersDAO) SearchByQueryNotIdList(q2 string, id_list []int32, limit int32) []dataobject.UsersDO

select id from users where username like :q2 and id not in (:id_list) limit :limit TODO(@benqi): sqlmap

func (*UsersDAO) SelectAccountDaysTTL

func (dao *UsersDAO) SelectAccountDaysTTL(id int32) *dataobject.UsersDO

select account_days_ttl from users where id = :id TODO(@benqi): sqlmap

func (*UsersDAO) SelectById

func (dao *UsersDAO) SelectById(id int32) *dataobject.UsersDO

select id, access_hash, first_name, last_name, username, phone, photos from users where id = :id limit 1 TODO(@benqi): sqlmap

func (*UsersDAO) SelectByPhoneNumber

func (dao *UsersDAO) SelectByPhoneNumber(phone string) *dataobject.UsersDO

select id, access_hash, first_name, last_name, username, banned, photos from users where phone = :phone limit 1 TODO(@benqi): sqlmap

func (*UsersDAO) SelectByQueryString

func (dao *UsersDAO) SelectByQueryString(username string, first_name string, last_name string, phone string) []dataobject.UsersDO

select id, access_hash, first_name, last_name, username, phone, photos from users where username = :username or first_name = :first_name or last_name = :last_name or phone = :phone limit 20 TODO(@benqi): sqlmap

func (*UsersDAO) SelectByUsername

func (dao *UsersDAO) SelectByUsername(username string) *dataobject.UsersDO

select id from users where username = :username limit 1 TODO(@benqi): sqlmap

func (*UsersDAO) SelectCountryCode

func (dao *UsersDAO) SelectCountryCode(id int32) *dataobject.UsersDO

select country_code from users where id = :id TODO(@benqi): sqlmap

func (*UsersDAO) SelectProfilePhotos

func (dao *UsersDAO) SelectProfilePhotos(id int32) *dataobject.UsersDO

select photos from users where id = :id TODO(@benqi): sqlmap

func (*UsersDAO) SelectUsersByIdList

func (dao *UsersDAO) SelectUsersByIdList(id_list []int32) []dataobject.UsersDO

select id, access_hash, first_name, last_name, username, phone, photos from users where id in (:id_list) TODO(@benqi): sqlmap

func (*UsersDAO) UpdateAbout

func (dao *UsersDAO) UpdateAbout(about string, id int32) int64

update users set about = :about where id = :id TODO(@benqi): sqlmap

func (*UsersDAO) UpdateAccountDaysTTL

func (dao *UsersDAO) UpdateAccountDaysTTL(account_days_ttl int32, id int32) int64

update users set account_days_ttl = :account_days_ttl where id = :id TODO(@benqi): sqlmap

func (*UsersDAO) UpdateFirstAndLastName

func (dao *UsersDAO) UpdateFirstAndLastName(first_name string, last_name string, id int32) int64

update users set first_name = :first_name, last_name = :last_name where id = :id TODO(@benqi): sqlmap

func (*UsersDAO) UpdateProfile

func (dao *UsersDAO) UpdateProfile(first_name string, last_name string, about string, id int32) int64

update users set first_name = :first_name, last_name = :last_name, about = :about where id = :id TODO(@benqi): sqlmap

func (*UsersDAO) UpdateProfilePhotos

func (dao *UsersDAO) UpdateProfilePhotos(photos string, id int32) int64

update users set photos = :photos where id = :id TODO(@benqi): sqlmap

func (*UsersDAO) UpdateUsername

func (dao *UsersDAO) UpdateUsername(username string, id int32) int64

update users set username = :username where id = :id TODO(@benqi): sqlmap

Jump to

Keyboard shortcuts

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