db

package
v0.0.0-...-d5841c9 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

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

type SetupRepository struct {
	DBClient *mongo.Client
	// contains filtered or unexported fields
}

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

Jump to

Keyboard shortcuts

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