db

package
v0.0.0-...-3d0adf2 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

====================================================

# Copyright (C)2019 All rights reserved. # # Author : domchan # Email : 814172254@qq.com # File Name : curd.go # Created : 2019/1/21 14:40 # Last Modified : 2019/1/21 14:40 # Describe : # # ====================================================

====================================================

# Copyright (C)2019 All rights reserved. # # Author : domchan # Email : 814172254@qq.com # File Name : msg.go # Created : 2019/1/28 11:37 # Last Modified : 2019/1/28 11:37 # Describe : # # ====================================================

====================================================

# Copyright (C)2019 All rights reserved. # # Author : domchan # Email : 814172254@qq.com # File Name : template.go # Created : 2019/1/15 15:39 # Last Modified : 2019/1/15 15:39 # Describe : # # ====================================================

====================================================

# Copyright (C)2019 All rights reserved. # # Author : domchan # Email : 814172254@qq.com # File Name : var.go # Created : 2019/1/14 14:26 # Last Modified : 2019/1/14 14:26 # Describe : # # ====================================================

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoRowsEffected  = errors.New("db: no rows affected")
	ErrUniqueKeyExsits = errors.New("db: Duplicate entry for key")
)

Functions

func Commit

func Commit(tx *sqlx.Tx) error

Commit 带空判断的提交

func DetailByKey

func DetailByKey(ctx context.Context, key string, page int) ([]*meta.DbMsg, error)

DetailByKey 根据key分页查询

func DetailByToAndPage

func DetailByToAndPage(ctx context.Context, to string, page int) ([]*meta.DbMsg, error)

DetailByToAndPage 根据接收人的标识分页查询

func RollBack

func RollBack(tx *sqlx.Tx) error

带空判断的回滚

func TemplateInsert

func TemplateInsert(ctx context.Context, templ *tpl.DBTemplate) (*sqlx.Tx, error)

TemplateInsert 插入消息模板到数据库,如果唯一键重复返回键已存在错误

func TemplateList

func TemplateList(ctx context.Context) (res []*tpl.DBTemplate, err error)

TemplateList 获取所有模板

func UpdateAndInsertMsgBatch

func UpdateAndInsertMsgBatch(ctx context.Context, ds []*meta.DbMsg) error

UpdateAndInsertMsgBatch 批量执行修改,如果不存在就插入

func WaitingMsgByKey

func WaitingMsgByKey(ctx context.Context, key string) ([]string, error)

WaitingMsgByKey 根据key值返回所有待发送的消息的id

Types

This section is empty.

Jump to

Keyboard shortcuts

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