ideas

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DuplicateVoteError added in v0.1.6

type DuplicateVoteError struct {
	User   string
	IdeaID int
}

func (*DuplicateVoteError) Error added in v0.1.6

func (e *DuplicateVoteError) Error() string

type Idea

type Idea struct {
	Id          int    `bson:"id"`
	Text        string `bson:"text,omitempty"`
	Description string `bson:"description,omitempty"`
	HasSpeaker  bool   `bson:"has_speaker,omitempty"`
	Creator     string `bson:"creator,omitempty"`
	Votes       int    `bson:"votes,omitempty"`
}

type InMemoryPersistence added in v0.1.6

type InMemoryPersistence struct {
	Ideas map[int]Idea
	Votes map[string]map[int]struct{}
}

func NewInMemoryPersistence added in v0.1.6

func NewInMemoryPersistence() InMemoryPersistence

func (InMemoryPersistence) GetAll added in v0.1.6

func (p InMemoryPersistence) GetAll() []Idea

func (InMemoryPersistence) StoreIdea added in v0.1.6

func (p InMemoryPersistence) StoreIdea(idea Idea) error

func (InMemoryPersistence) StoreVote added in v0.1.6

func (p InMemoryPersistence) StoreVote(userId string, ideaId int) (votes int, err error)

type MongoDBPersistence added in v0.1.6

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

func NewMongoDBPersistence added in v0.1.6

func NewMongoDBPersistence(connectionstring string) (MongoDBPersistence, error)

func (*MongoDBPersistence) Close added in v0.1.6

func (m *MongoDBPersistence) Close()

func (*MongoDBPersistence) GetAll added in v0.1.6

func (m *MongoDBPersistence) GetAll() ([]Idea, error)

func (*MongoDBPersistence) StoreIdea added in v0.1.6

func (m *MongoDBPersistence) StoreIdea(idea Idea) error

func (*MongoDBPersistence) StoreVote added in v0.1.6

func (m *MongoDBPersistence) StoreVote(userId string, ideaId int) (votes int, err error)

type PersistenceError added in v0.1.6

type PersistenceError struct {
	Msg string
	Err error
}

func (*PersistenceError) Error added in v0.1.6

func (e *PersistenceError) Error() string

type Vote added in v0.1.6

type Vote struct {
	UsrID  string `bson:"usr_id"`
	IdeaID int    `bson:"idea_id"`
}

Jump to

Keyboard shortcuts

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