database

package
v0.0.0-...-a723260 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorEnvVar = fmt.Errorf("missing environment variable")

ErrorEnvVar : Environment variable error

Functions

func ExtractValue

func ExtractValue(body string, key string) string

extracts the value for a key from a JSON-formatted string body - the JSON-response as a string. Usually retrieved via the request body key - the key for which the value should be extracted returns - the value for the given key

Types

type MockRelationships

type MockRelationships struct {
}

func (*MockRelationships) AddRelationship

func (mp *MockRelationships) AddRelationship(ctx context.Context, relationship *data.Relationship) error

func (*MockRelationships) CloseDB

func (mp *MockRelationships) CloseDB()

func (*MockRelationships) Connect

func (mp *MockRelationships) Connect() error

func (*MockRelationships) DeleteRelationship

func (mp *MockRelationships) DeleteRelationship(ctx context.Context, id string) error

func (*MockRelationships) GetFriendsListByUserID

func (mp *MockRelationships) GetFriendsListByUserID(ctx context.Context, userID string) (*data.DetailedRelationships, error)

func (*MockRelationships) GetInvitesListByUserID

func (mp *MockRelationships) GetInvitesListByUserID(ctx context.Context, userID string) (*data.DetailedRelationships, error)

func (*MockRelationships) GetUserByID

func (mp *MockRelationships) GetUserByID(userID string) (*data.DetailedUser, error)

func (*MockRelationships) GetUserDetails

func (mp *MockRelationships) GetUserDetails(userID string, relations data.Relationships) (*data.DetailedRelationships, error)

func (*MockRelationships) PingDB

func (mp *MockRelationships) PingDB() error

func (*MockRelationships) UpdateRelationship

func (mp *MockRelationships) UpdateRelationship(ctx context.Context, relationship *data.Relationship) error

type MongoRelationships

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

func (*MongoRelationships) AddRelationship

func (mp *MongoRelationships) AddRelationship(ctx context.Context, relationship *data.Relationship) error

func (*MongoRelationships) CloseDB

func (mp *MongoRelationships) CloseDB()

func (*MongoRelationships) Connect

func (mp *MongoRelationships) Connect() error

func (*MongoRelationships) DeleteRelationship

func (mp *MongoRelationships) DeleteRelationship(ctx context.Context, id string) error

func (*MongoRelationships) GetFriendsListByUserID

func (mp *MongoRelationships) GetFriendsListByUserID(ctx context.Context, userID string) (*data.DetailedRelationships, error)

func (*MongoRelationships) GetInvitesListByUserID

func (mp *MongoRelationships) GetInvitesListByUserID(ctx context.Context, userID string) (*data.DetailedRelationships, error)

func (*MongoRelationships) GetUserByID

func (mp *MongoRelationships) GetUserByID(userID string) (*data.DetailedUser, error)

func (*MongoRelationships) GetUserDetails

func (mp *MongoRelationships) GetUserDetails(userID string, relations data.Relationships) (*data.DetailedRelationships, error)

func (*MongoRelationships) PingDB

func (mp *MongoRelationships) PingDB() error

func (*MongoRelationships) UpdateRelationship

func (mp *MongoRelationships) UpdateRelationship(ctx context.Context, relationship *data.Relationship) error

type RelationshipDB

type RelationshipDB interface {
	GetFriendsListByUserID(ctx context.Context, userID string) (*data.DetailedRelationships, error)
	GetInvitesListByUserID(ctx context.Context, userID string) (*data.DetailedRelationships, error)
	UpdateRelationship(ctx context.Context, relationship *data.Relationship) error
	AddRelationship(ctx context.Context, relationship *data.Relationship) error
	DeleteRelationship(ctx context.Context, id string) error
	GetUserDetails(userID string, relations data.Relationships) (*data.DetailedRelationships, error)
	GetUserByID(userID string) (*data.DetailedUser, error)
	Connect() error
	PingDB() error
	CloseDB()
}

The interface that any kind of database must implement

func NewMockRelationships

func NewMockRelationships() RelationshipDB

func NewMongoRelationships

func NewMongoRelationships() RelationshipDB

Jump to

Keyboard shortcuts

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