store

package
v0.0.0-...-8c85031 Latest Latest
Warning

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

Go to latest
Published: May 12, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateUserNoToken

func CreateUserNoToken(d Database, u *sidebar.User) (*sidebar.User, error)

CreateUserNoToken is used to create a default user when the app starts and no token is available.

Types

type Adder

type Adder interface {
	AddUserToChannel(string, string) error
	RemoveUserFromChannel(string, string) error
	ResolveChannel(string) error
	AddUserToWorkspace(string, string) error
	AddChannelToWorkspace(string, string) error
}

Adder provides methods for updating an existing channel. "Adder" probably isn't the right name anymore.

type Authenticater

type Authenticater interface {
	UserForAuth(string) (*sidebar.User, error)
	UserInWorkspace(string, string) error
	ChannelInWorkspace(string, string) error
}

Authenticater provies methods for authenticating a user with data from the database.

type Creater

type Creater interface {
	CreateUser(*sidebar.User) (*sidebar.User, error)
	CreateWorkspace(*sidebar.Workspace) (*sidebar.Workspace, error)
	CreateDefaultWorkspace(*sidebar.Workspace) (*sidebar.Workspace, error)
	CreateChannel(*sidebar.Channel) (*sidebar.Channel, error)
	CreateMessage(*sidebar.ChatMessage) (*sidebar.ChatMessage, error)
}

Creater ...

type Database

type Database interface {
	Adder
	Deleter
	Creater
	Getter
	Updater
	Authenticater
	sq.BaseRunner
	Empty() error

	Close()
}

Database provides methods to query the database.

func New

func New(psqlInfo string) (Database, error)

New connects to the postgres database and returns that connection.

type Deleter

type Deleter interface {
	DeleteUser(string) (*sidebar.User, error)
	DeleteChannel(string) (*sidebar.Channel, error)
}

Deleter provides methods for deleting rows from the database.

type Getter

type Getter interface {
	GetWorkspacesForUser(string) ([]*sidebar.Workspace, error)
	GetWorkspaces() ([]*sidebar.Workspace, error)
	GetWorkspace(string) (*sidebar.Workspace, error)
	GetDefaultWorkspace() (*sidebar.Workspace, error)
	GetWorkspaceToken(string) (string, error)
	GetWorkspaceExists(string) error
	GetUser(string) (*sidebar.User, error)
	GetChannel(string) (*sidebar.Channel, error)
	GetMessage(string) (*sidebar.ChatMessage, error)

	GetUsers() ([]*sidebar.User, error)
	GetChannels() ([]*sidebar.Channel, error)
	GetMessages() ([]*sidebar.ChatMessage, error)

	GetUsersInChannel(string) ([]*sidebar.User, error)
	GetChannelsForUser(string) ([]*sidebar.Channel, error)

	GetMessagesInChannel(string) ([]*sidebar.ChatMessage, error)
	GetMessagesFromUser(string) ([]*sidebar.ChatMessage, error)
	GetMessagesToUser(string) ([]*sidebar.ChatMessage, error)
}

Getter provides methods for retrieiving different sets of data from the database.

type Updater

type Updater interface {
	UpdateWorkspaceImage(string, string) error
	UpdateUserInformation(*sidebar.User) error
	UpdateChannelInformation(*sidebar.Channel) error
	UpdateUserPassword(string, []byte) error
}

Updater provides methods for updating rows stored in teh database.

Jump to

Keyboard shortcuts

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