db

package
v0.0.0-...-5318e64 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotExist not found
	ErrNotExist = errors.New("value not exist")
)

Functions

This section is empty.

Types

type Dber

type Dber interface {
	Exec(string, ...interface{}) (sql.Result, error)
	ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
	Prepare(query string) (*sql.Stmt, error)
	PrepareContext(ctx context.Context, query string) (*sql.Stmt, error)
	Query(query string, args ...interface{}) (*sql.Rows, error)
	QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
	QueryRow(query string, args ...interface{}) *sql.Row
	QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
}

Dber 数据库操作接口

type ShortURLDB

type ShortURLDB struct {
	DB *gorm.DB
}

ShortURLDB 短链接存储数据库

func New

func New(typeStr, pathStr string) (*ShortURLDB, error)

New 创建新的数据库对象

func (*ShortURLDB) CLose

func (d *ShortURLDB) CLose() error

CLose close database

func (*ShortURLDB) Get

func (d *ShortURLDB) Get(key string) (string, error)

Get 获取

func (*ShortURLDB) Set

func (d *ShortURLDB) Set(key string) (*models.URLMap, error)

Set 设置

Jump to

Keyboard shortcuts

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