Documentation ¶
Index ¶
- Variables
- type Fact
- type FactsRepository
- type MockFactsRepository
- func (m *MockFactsRepository) Close() error
- func (m *MockFactsRepository) Count() (int, error)
- func (m *MockFactsRepository) Create(fact *Fact) error
- func (m *MockFactsRepository) Delete(id primitive.ObjectID) error
- func (m *MockFactsRepository) ReadAll() ([]*Fact, error)
- func (m *MockFactsRepository) ReadManyIDs(filterFunc func(fact *Fact) bool) ([]primitive.ObjectID, error)
- func (m *MockFactsRepository) ReadOne(id primitive.ObjectID) (*Fact, error)
- func (m *MockFactsRepository) Update(id primitive.ObjectID, updateFunc func(fact *Fact) *Fact) error
- type MongoDBFactsRepository
- func (m *MongoDBFactsRepository) Close() error
- func (m *MongoDBFactsRepository) Count() (int, error)
- func (m *MongoDBFactsRepository) Create(fact *Fact) error
- func (m *MongoDBFactsRepository) Delete(id primitive.ObjectID) error
- func (m *MongoDBFactsRepository) ReadAll() ([]*Fact, error)
- func (m *MongoDBFactsRepository) ReadManyIDs(filterFunc func(fact *Fact) bool) ([]primitive.ObjectID, error)
- func (m *MongoDBFactsRepository) ReadOne(id primitive.ObjectID) (*Fact, error)
- func (m *MongoDBFactsRepository) Update(id primitive.ObjectID, updateFunc func(fact *Fact) *Fact) error
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotFound = errors.New("fact not found")
)
Functions ¶
This section is empty.
Types ¶
type Fact ¶
type Fact struct { ID primitive.ObjectID `bson:"_id" json:"id"` Fact string `bson:"fact" json:"fact"` Source string `bson:"source" json:"source"` Approved bool `bson:"approved" json:"approved"` CreatedAt time.Time `bson:"created_at" json:"createdAt"` CreatedBy string `bson:"created_by" json:"createdBy"` UpdatedAt time.Time `bson:"updated_at" json:"updatedAt"` UpdatedBy string `bson:"updated_by" json:"updatedBy"` }
type FactsRepository ¶
type FactsRepository interface { Create(fact *Fact) error ReadOne(id primitive.ObjectID) (*Fact, error) ReadManyIDs(filterFunc func(fact *Fact) bool) ([]primitive.ObjectID, error) ReadAll() ([]*Fact, error) Update(id primitive.ObjectID, updateFunc func(fact *Fact) *Fact) error Delete(id primitive.ObjectID) error Count() (int, error) Close() error }
func NewMockFactsRepository ¶
func NewMockFactsRepository(facts map[primitive.ObjectID]*Fact, errorAllFunctionCalls bool) FactsRepository
func NewMongoDBFactsRepository ¶
func NewMongoDBFactsRepository(mongoDbUri string) (FactsRepository, error)
type MockFactsRepository ¶
type MockFactsRepository struct {
// contains filtered or unexported fields
}
func (*MockFactsRepository) Close ¶
func (m *MockFactsRepository) Close() error
func (*MockFactsRepository) Count ¶
func (m *MockFactsRepository) Count() (int, error)
func (*MockFactsRepository) Create ¶
func (m *MockFactsRepository) Create(fact *Fact) error
func (*MockFactsRepository) Delete ¶
func (m *MockFactsRepository) Delete(id primitive.ObjectID) error
func (*MockFactsRepository) ReadAll ¶
func (m *MockFactsRepository) ReadAll() ([]*Fact, error)
func (*MockFactsRepository) ReadManyIDs ¶
type MongoDBFactsRepository ¶
type MongoDBFactsRepository struct {
// contains filtered or unexported fields
}
func (*MongoDBFactsRepository) Close ¶
func (m *MongoDBFactsRepository) Close() error
func (*MongoDBFactsRepository) Count ¶
func (m *MongoDBFactsRepository) Count() (int, error)
func (*MongoDBFactsRepository) Create ¶
func (m *MongoDBFactsRepository) Create(fact *Fact) error
func (*MongoDBFactsRepository) Delete ¶
func (m *MongoDBFactsRepository) Delete(id primitive.ObjectID) error
func (*MongoDBFactsRepository) ReadAll ¶
func (m *MongoDBFactsRepository) ReadAll() ([]*Fact, error)
func (*MongoDBFactsRepository) ReadManyIDs ¶
Click to show internal directories.
Click to hide internal directories.