Documentation ¶
Index ¶
- func SetStore(dbInst Store) error
- type CreateQuery
- type Group
- type Movie
- type PostgresStore
- func (pg *PostgresStore) AddUserToGroup(userName, groupID string) (err error)
- func (pg *PostgresStore) CreateGroup(group *Group) (err error)
- func (pg *PostgresStore) CreateUser(user *User) (err error)
- func (pg *PostgresStore) DeleteGroup(groupID string) (err error)
- func (pg *PostgresStore) DeleteUser(userName string) (err error)
- func (pg *PostgresStore) GetAllGroups() (groups []*Group, err error)
- func (pg *PostgresStore) GetAllUsers() (users []*User, err error)
- func (pg *PostgresStore) GetGroup(groupID string) (group *Group, err error)
- func (pg *PostgresStore) GetGroupsForUser(userName string) (groups []*Group, err error)
- func (pg *PostgresStore) GetUser(userName string) (user *User, err error)
- func (pg *PostgresStore) GetUserWithEmail(email string) (user *User, err error)
- func (pg *PostgresStore) GetUsersInGroup(groupID string) (users []*User, err error)
- func (pg *PostgresStore) GroupExists(groupID string) (exists bool, err error)
- func (pg *PostgresStore) RemoveUserFromGroup(userName, groupID string) (err error)
- func (pg *PostgresStore) UpdateGroup(group *Group) (err error)
- func (pg *PostgresStore) UpdateUser(user *User) (err error)
- func (pg *PostgresStore) UserExists(userName string) (exists bool, err error)
- func (pg *PostgresStore) UserExistsInGroup(userName, groupID string) (exists bool, err error)
- func (pg *PostgresStore) UserExistsWithEmail(email string) (exists bool, err error)
- type PsqlOptions
- type Series
- type Show
- type Store
- type User
- type Visiblity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CreateQuery ¶
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 PostgresStore ¶
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 ¶
PsqlOptions - options for connecting to sqlite database
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
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" )