database

package
v0.0.0-...-557a82b Latest Latest
Warning

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

Go to latest
Published: May 17, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database interface {
	Get(ctx context.Context, key model.Key) (model.Value, error)
	Put(ctx context.Context, key model.Key, value model.Value) error
	Delete(ctx context.Context, key model.Key) error
}

Database represents a database which has no insert and update method. We can use MySQL for inserting and updating but this is just an example.

type MySQL

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

func NewMySQL

func NewMySQL(dsn string) *MySQL

func (*MySQL) Delete

func (db *MySQL) Delete(ctx context.Context, key model.Key) error

func (*MySQL) Get

func (db *MySQL) Get(ctx context.Context, key model.Key) (model.Value, error)

func (*MySQL) Put

func (db *MySQL) Put(ctx context.Context, key model.Key, value model.Value) error

func (*MySQL) Run

func (db *MySQL) Run(ctx context.Context, ready chan<- struct{}) error

Jump to

Keyboard shortcuts

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