Documentation ¶
Index ¶
- func GetDatabaseName() string
- type IndexesRepository
- type SetupRepository
- func (s *SetupRepository) CreateIndexes() error
- func (s *SetupRepository) CreateInitialStaffMember() error
- func (s *SetupRepository) CreateSettingCollection(w io.ReadWriter, ctx context.Context) error
- func (s *SetupRepository) Initialize(w io.ReadWriter, ctx context.Context) error
- func (s *SetupRepository) ShouldSetupDB(ctx context.Context) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDatabaseName ¶
func GetDatabaseName() string
GetDatabaseName determine the database name to use based on whether the config has been set or not. If the config DB name isn't set, it defaults to the default database name
Types ¶
type IndexesRepository ¶
type IndexesRepository struct {
// contains filtered or unexported fields
}
func NewIndexesRepository ¶
func NewIndexesRepository(dbClient *mongo.Client) *IndexesRepository
func (IndexesRepository) StaffCollectionIndexes ¶
func (i IndexesRepository) StaffCollectionIndexes(w io.ReadWriter, ctx context.Context) error
type SetupRepository ¶
SetupRepository the database with the default values and indexes
func NewSetupRepository ¶
func NewSetupRepository(dbClient *mongo.Client) *SetupRepository
func (*SetupRepository) CreateIndexes ¶
func (s *SetupRepository) CreateIndexes() error
CreateIndexes creates the indexes for the database
func (*SetupRepository) CreateInitialStaffMember ¶
func (s *SetupRepository) CreateInitialStaffMember() error
CreateInitialStaffMember creates the initial Staff Member for the CMS, the initial user is going to be setup via the API
func (*SetupRepository) CreateSettingCollection ¶
func (s *SetupRepository) CreateSettingCollection(w io.ReadWriter, ctx context.Context) error
CreateSettingCollection creates a capped settings collection in the database that only stores a single document. This is ideal for storing settings as you only want a single document in the collection for the CMSs settings.
func (*SetupRepository) Initialize ¶
func (s *SetupRepository) Initialize(w io.ReadWriter, ctx context.Context) error
Initialize the database with the default values and indexes
func (*SetupRepository) ShouldSetupDB ¶
func (s *SetupRepository) ShouldSetupDB(ctx context.Context) (bool, error)
if database doesn't exist create collection and add necessary indexes