Documentation ¶
Index ¶
- Constants
- Variables
- func IDStringFromResult(oid interface{}) string
- func IDToObjectID(id string) (primitive.ObjectID, error)
- func IDsToObjectIDs(ids []string) ([]primitive.ObjectID, error)
- func NewMongoDatastore() (datastore.Datastore, error)
- func ToObjectID(id string) (primitive.ObjectID, error)
- type CourseStore
- type FileInfoStore
- func (s *FileInfoStore) Count(c context.Context) (int64, error)
- func (s *FileInfoStore) Get(c context.Context, id string) (*models.FileInfo, error)
- func (s *FileInfoStore) GetAll(c context.Context) ([]*models.FileInfo, error)
- func (s *FileInfoStore) Save(c context.Context, fi *models.FileInfo) error
- type Model
- type MongoDatastore
- func (s *MongoDatastore) Coll(name string) *mongo.Collection
- func (s *MongoDatastore) Count(c context.Context, collection string) (int64, error)
- func (s *MongoDatastore) Course() datastore.CourseStore
- func (s *MongoDatastore) FileInfo() datastore.FileInfoStore
- func (s *MongoDatastore) Find(c context.Context, collection string, decode interface{}) error
- func (s *MongoDatastore) FindByID(c context.Context, collection string, id string, decode interface{}) error
- func (s *MongoDatastore) FindByIDs(c context.Context, collection string, ids []string, decode interface{}) error
- func (s *MongoDatastore) Insert(c context.Context, collection string, model interface{}) (string, error)
- func (s *MongoDatastore) TestConnection(c context.Context) error
- func (s *MongoDatastore) Update(c context.Context, collection string, model Model) error
- func (s *MongoDatastore) User() datastore.UserStore
- type UserStore
- func (s *UserStore) Count(c context.Context) (int64, error)
- func (s *UserStore) Get(c context.Context, id string) (*models.User, error)
- func (s *UserStore) GetAll(c context.Context, opts *models.UserGetOptions) ([]*models.User, error)
- func (s *UserStore) GetByIDs(c context.Context, userIDs []string) ([]*models.User, error)
- func (s *UserStore) GetByUsername(c context.Context, username string) (*models.User, error)
- func (s *UserStore) Save(c context.Context, user *models.User) error
- func (s *UserStore) Update(c context.Context, user *models.User) error
Constants ¶
View Source
const (
USERS = "users"
)
Variables ¶
View Source
var (
ErrConnectionRefused = errors.New("Cannot connect to database")
)
View Source
var (
ErrCourseExists = errors.New("datastore.mongo.user.save.user_exists")
)
View Source
var (
ErrUserExists = errors.New("datastore.mongo.user.save.user_exists")
)
Functions ¶
func IDStringFromResult ¶
func IDStringFromResult(oid interface{}) string
func NewMongoDatastore ¶
Types ¶
type CourseStore ¶
type CourseStore struct {
// contains filtered or unexported fields
}
type FileInfoStore ¶
type FileInfoStore struct {
// contains filtered or unexported fields
}
type MongoDatastore ¶
type MongoDatastore struct { DB *mongo.Database Client *mongo.Client // contains filtered or unexported fields }
func (*MongoDatastore) Coll ¶
func (s *MongoDatastore) Coll(name string) *mongo.Collection
func (*MongoDatastore) Course ¶
func (s *MongoDatastore) Course() datastore.CourseStore
func (*MongoDatastore) FileInfo ¶
func (s *MongoDatastore) FileInfo() datastore.FileInfoStore
func (*MongoDatastore) Find ¶
func (s *MongoDatastore) Find(c context.Context, collection string, decode interface{}) error
func (*MongoDatastore) TestConnection ¶
func (s *MongoDatastore) TestConnection(c context.Context) error
func (*MongoDatastore) User ¶
func (s *MongoDatastore) User() datastore.UserStore
Click to show internal directories.
Click to hide internal directories.