data

package
v0.0.0-...-e107a19 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2017 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetStore

func SetStore(dbInst Store) error

SetStore sets the application wIDe data store to be used

Types

type CreateQuery

type CreateQuery struct {
	TableName   string
	QueryString string
}

CreateQuery - Represents a query that creates a table

type Group

type Group struct {
	GroupID     string    `json:"groupID" db:"group_id"`
	Name        string    `json:"groupName" db:"name"`
	Owner       string    `json:"groupOwner" db:"owner"`
	Description string    `json:"groupDesc" db:"description"`
	Visiblity   Visiblity `json:"visibility" db:"visibility"`
}

Group - is a set of users, who can share permissions

type Movie

type Movie struct {
	Show
}

Movie -

type PostgresStore

type PostgresStore struct {
	*sqlx.DB
}

PostgresStore - datasource implemented using postgress

func PsqlInit

func PsqlInit(options *PsqlOptions) (pgdb *PostgresStore, err error)

PsqlInit - initializes the datastore

func (*PostgresStore) AddUserToGroup

func (pg *PostgresStore) AddUserToGroup(userName, groupID string) (err error)

AddUserToGroup -

func (*PostgresStore) CreateGroup

func (pg *PostgresStore) CreateGroup(group *Group) (err error)

CreateGroup -

func (*PostgresStore) CreateUser

func (pg *PostgresStore) CreateUser(user *User) (err error)

CreateUser -

func (*PostgresStore) DeleteGroup

func (pg *PostgresStore) DeleteGroup(groupID string) (err error)

DeleteGroup -

func (*PostgresStore) DeleteUser

func (pg *PostgresStore) DeleteUser(userName string) (err error)

DeleteUser -

func (*PostgresStore) GetAllGroups

func (pg *PostgresStore) GetAllGroups() (groups []*Group, err error)

GetAllGroups -

func (*PostgresStore) GetAllUsers

func (pg *PostgresStore) GetAllUsers() (users []*User, err error)

GetAllUsers -

func (*PostgresStore) GetGroup

func (pg *PostgresStore) GetGroup(groupID string) (group *Group, err error)

GetGroup -

func (*PostgresStore) GetGroupsForUser

func (pg *PostgresStore) GetGroupsForUser(
	userName string) (groups []*Group, err error)

GetGroupsForUser -

func (*PostgresStore) GetUser

func (pg *PostgresStore) GetUser(userName string) (user *User, err error)

GetUser -

func (*PostgresStore) GetUserWithEmail

func (pg *PostgresStore) GetUserWithEmail(email string) (user *User, err error)

GetUserWithEmail -

func (*PostgresStore) GetUsersInGroup

func (pg *PostgresStore) GetUsersInGroup(
	groupID string) (users []*User, err error)

GetUsersInGroup -

func (*PostgresStore) GroupExists

func (pg *PostgresStore) GroupExists(groupID string) (exists bool, err error)

GroupExists -

func (*PostgresStore) RemoveUserFromGroup

func (pg *PostgresStore) RemoveUserFromGroup(userName, groupID string) (err error)

RemoveUserFromGroup -

func (*PostgresStore) UpdateGroup

func (pg *PostgresStore) UpdateGroup(group *Group) (err error)

UpdateGroup -

func (*PostgresStore) UpdateUser

func (pg *PostgresStore) UpdateUser(user *User) (err error)

UpdateUser -

func (*PostgresStore) UserExists

func (pg *PostgresStore) UserExists(userName string) (exists bool, err error)

UserExists -

func (*PostgresStore) UserExistsInGroup

func (pg *PostgresStore) UserExistsInGroup(
	userName, groupID string) (exists bool, err error)

UserExistsInGroup -

func (*PostgresStore) UserExistsWithEmail

func (pg *PostgresStore) UserExistsWithEmail(email string) (exists bool, err error)

UserExistsWithEmail -

type PsqlOptions

type PsqlOptions struct {
	UserName string
	Password string
	Host     string
	Port     int
	DBName   string
}

PsqlOptions - options for connecting to sqlite database

type Series

type Series struct {
	Show
}

Series -

type Show

type Show struct {
	ID   string `json:"id" db:"id"`
	Name string `json:"name" db:"name"`
	Year int    `json:"year" db:"year"`
}

Show -

type Store

type Store interface {
	GetAllUsers() (users []*User, err error)
	GetUser(userName string) (user *User, err error)
	GetUserWithEmail(email string) (user *User, err error)
	UserExists(userName string) (exists bool, err error)
	UserExistsWithEmail(email string) (exists bool, err error)
	CreateUser(user *User) (err error)
	UpdateUser(user *User) (err error)
	DeleteUser(userName string) (err error)

	GetAllGroups() (groups []*Group, err error)
	GetGroup(GroupID string) (group *Group, err error)
	GroupExists(GroupID string) (exists bool, err error)
	CreateGroup(Group *Group) (err error)
	UpdateGroup(Group *Group) (err error)
	DeleteGroup(GroupID string) (err error)
	AddUserToGroup(userName, groupID string) (err error)
	UserExistsInGroup(userName, groupID string) (exists bool, err error)
	RemoveUserFromGroup(userName, groupID string) (err error)
	GetUsersInGroup(groupID string) (userInGroup []*User, err error)
	GetGroupsForUser(userName string) (groupsForUser []*Group, err error)
}

Store - interface declares the operation that will be exposed by a application data store

func GetStore

func GetStore() Store

GetStore - give the application data store

type User

type User struct {
	Name       string `json:"name" db:"user_name"`
	FirstName  string `json:"firstName" db:"first_name"`
	SecondName string `json:"secondName" db:"second_name"`
	Email      string `json:"email" db:"email"`
}

User - struct representing the user of the service

type Visiblity

type Visiblity string

Visiblity - determines the visibility of an entity

const (
	//Public - the endpoint and its properties are visible to everybody
	Public Visiblity = "public"

	//GroupPrivate - the endpoint and its properties are visible only to
	// owner's groups
	GroupPrivate Visiblity = "group_private"

	//Private - the endpoint and its properties are visible only to owner
	Private Visiblity = "private"
)

Jump to

Keyboard shortcuts

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