datastore

package
v0.0.0-...-d41341d Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2018 License: BSD-3-Clause Imports: 10 Imported by: 6

Documentation

Index

Constants

View Source
const (
	MYSQL = iota
	MONGODB
	REDIS
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Datastore

type Datastore interface {
	CreateUser(user *models.User) error
	GetUser(username string) (*models.User, error)
	Close()
}

func NewDatastore

func NewDatastore(datastoreType int, dbConnectionString string) (Datastore, error)

type MongoDBDatastore

type MongoDBDatastore struct {
	*mgo.Session
}

func NewMongoDBDatastore

func NewMongoDBDatastore(url string) (*MongoDBDatastore, error)

func (*MongoDBDatastore) Close

func (m *MongoDBDatastore) Close()

func (*MongoDBDatastore) CreateUser

func (m *MongoDBDatastore) CreateUser(user *models.User) error

func (*MongoDBDatastore) GetUser

func (m *MongoDBDatastore) GetUser(username string) (*models.User, error)

type MySQLDatastore

type MySQLDatastore struct {
	*sql.DB
}

func NewMySQLDatastore

func NewMySQLDatastore(dataSourceName string) (*MySQLDatastore, error)

func (*MySQLDatastore) Close

func (m *MySQLDatastore) Close()

func (*MySQLDatastore) CreateUser

func (m *MySQLDatastore) CreateUser(user *models.User) error

func (*MySQLDatastore) GetUser

func (m *MySQLDatastore) GetUser(username string) (*models.User, error)

type RedisDatastore

type RedisDatastore struct {
	*pool.Pool
}

func NewRedisDatastore

func NewRedisDatastore(address string) (*RedisDatastore, error)

func (*RedisDatastore) Close

func (r *RedisDatastore) Close()

func (*RedisDatastore) CreateUser

func (r *RedisDatastore) CreateUser(user *models.User) error

func (*RedisDatastore) GetUser

func (r *RedisDatastore) GetUser(username string) (*models.User, error)

Jump to

Keyboard shortcuts

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