userfavoritesstore

package
v0.0.0-...-f34f428 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitRepositoryProvider

func InitRepositoryProvider(databaseProvider string)

InitRepositoryProvider - One time init for the given DB Provider

Types

type FavoritesDBStore

type FavoritesDBStore struct {
	// contains filtered or unexported fields
}

FavoritesDBStore is a DB-backed User Favorites repository

func (*FavoritesDBStore) Delete

func (p *FavoritesDBStore) Delete(userGUID string, guid string) error

Delete will delete a User Favorite from the datastore

func (*FavoritesDBStore) DeleteFromEndpoint

func (p *FavoritesDBStore) DeleteFromEndpoint(endpointGUID string) error

DeleteFromEndpoint will remove all favorites for a given endpoint guid

func (*FavoritesDBStore) List

func (p *FavoritesDBStore) List(userGUID string) ([]*UserFavoriteRecord, error)

List - Returns a list of all user favorites

func (*FavoritesDBStore) Save

func (p *FavoritesDBStore) Save(favoriteRecord UserFavoriteRecord) (*UserFavoriteRecord, error)

Save will persist a User Favorite to a datastore

func (*FavoritesDBStore) SetMetadata

func (p *FavoritesDBStore) SetMetadata(userGUID string, guid string, metadata string) error

SetMetadata will set the metadata for a User Favorite from the datastore

type FavoritesStore

type FavoritesStore interface {
	List(userGUID string) ([]*UserFavoriteRecord, error)
	Delete(userGUID string, guid string) error
	Save(favoriteRecord UserFavoriteRecord) (*UserFavoriteRecord, error)
	SetMetadata(userGUID string, guid string, metadata string) error
	DeleteFromEndpoint(endpointGUID string) error
}

FavoritesStore is the user favorites repository

func NewFavoritesDBStore

func NewFavoritesDBStore(dcp *sql.DB) (FavoritesStore, error)

NewFavoritesDBStore will create a new instance of the FavoritesDBStore

type UserFavoriteRecord

type UserFavoriteRecord struct {
	GUID         string                 `json:"guid"`
	UserGUID     string                 `json:"-"`
	EndpointType string                 `json:"endpointType"`
	EndpointID   string                 `json:"endpointId"`
	EntityType   string                 `json:"entityType"`
	EntityID     string                 `json:"entityId"`
	Metadata     map[string]interface{} `json:"metadata"`
}

Jump to

Keyboard shortcuts

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