datastore

package
v0.0.0-...-4004e94 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MYSQL = iota
)

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()
	GetUserProfile(uuid string) (*models.UserProfile, error)
	UpdateUserProfile(uuid, about, location, interests string) error
	UpdateUserProfileImage(uuid, profileImagePath string) error
	FindGophers(owner string, searchTerm string) ([]models.Gopher, error)
	FriendsList(owner string) ([]models.Gopher, error)
	FollowGopher(owner string, friend string) error
	UnfollowGopher(owner string, friend string) error
	SavePost(owner string, title string, body string, mood int) error
	FetchPosts(owner string) ([]socialmedia.Post, error)
	GetGopherProfile(username string) (*models.UserProfile, error)
}

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) FetchPosts

func (m *MySQLDatastore) FetchPosts(owner string) ([]socialmedia.Post, error)

func (*MySQLDatastore) FindGophers

func (m *MySQLDatastore) FindGophers(owner string, searchTerm string) ([]models.Gopher, error)

func (*MySQLDatastore) FollowGopher

func (m *MySQLDatastore) FollowGopher(owner string, friend string) error

func (*MySQLDatastore) FriendsList

func (m *MySQLDatastore) FriendsList(owner string) ([]models.Gopher, error)

func (*MySQLDatastore) GetGopherProfile

func (m *MySQLDatastore) GetGopherProfile(username string) (*models.UserProfile, error)

func (*MySQLDatastore) GetUser

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

func (*MySQLDatastore) GetUserProfile

func (m *MySQLDatastore) GetUserProfile(uuid string) (*models.UserProfile, error)

func (*MySQLDatastore) SavePost

func (m *MySQLDatastore) SavePost(owner string, title string, body string, mood int) error

func (*MySQLDatastore) UnfollowGopher

func (m *MySQLDatastore) UnfollowGopher(owner string, friend string) error

func (*MySQLDatastore) UpdateUserProfile

func (m *MySQLDatastore) UpdateUserProfile(uuid, about, location, interests string) error

func (*MySQLDatastore) UpdateUserProfileImage

func (m *MySQLDatastore) UpdateUserProfileImage(uuid, profileImagePath string) 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