Documentation
¶
Overview ¶
Package mongo implements every *.Repository interface against MongoDB. Entities carry explicit `bson:"<lowercase>"` tags; constants in fields.go mirror them. Unique indexes here stand in for the SQL UNIQUE constraints. Errors are reused from `repoerrors` so use cases' `errors.As` checks work.
Index ¶
- Constants
- func Connect(ctx context.Context, uri string, log logger.Interface) (*mongo.Client, *mongo.Database, error)
- type CIRARepo
- func (r *CIRARepo) Delete(ctx context.Context, configName, tenantID string) (bool, error)
- func (r *CIRARepo) Get(ctx context.Context, top, skip int, tenantID string) ([]entity.CIRAConfig, error)
- func (r *CIRARepo) GetByName(ctx context.Context, configName, tenantID string) (*entity.CIRAConfig, error)
- func (r *CIRARepo) GetCount(ctx context.Context, tenantID string) (int, error)
- func (r *CIRARepo) Insert(ctx context.Context, c *entity.CIRAConfig) (string, error)
- func (r *CIRARepo) Update(ctx context.Context, c *entity.CIRAConfig) (bool, error)
- type DeviceRepo
- func (r *DeviceRepo) Delete(ctx context.Context, guid, tenantID string) (bool, error)
- func (r *DeviceRepo) Get(ctx context.Context, top, skip int, tenantID string) ([]entity.Device, error)
- func (r *DeviceRepo) GetByColumn(ctx context.Context, columnName, queryValue, tenantID string) ([]entity.Device, error)
- func (r *DeviceRepo) GetByID(ctx context.Context, guid, tenantID string) (*entity.Device, error)
- func (r *DeviceRepo) GetByTags(ctx context.Context, tags []string, method string, limit, offset int, ...) ([]entity.Device, error)
- func (r *DeviceRepo) GetCount(ctx context.Context, tenantID string) (int, error)
- func (r *DeviceRepo) GetDistinctTags(ctx context.Context, tenantID string) ([]string, error)
- func (r *DeviceRepo) Insert(ctx context.Context, d *entity.Device) (string, error)
- func (r *DeviceRepo) Update(ctx context.Context, d *entity.Device) (bool, error)
- func (r *DeviceRepo) UpdateConnectionStatus(ctx context.Context, guid string, status bool) error
- func (r *DeviceRepo) UpdateLastSeen(ctx context.Context, guid string) error
- type DomainRepo
- func (r *DomainRepo) Delete(ctx context.Context, name, tenantID string) (bool, error)
- func (r *DomainRepo) Get(ctx context.Context, top, skip int, tenantID string) ([]entity.Domain, error)
- func (r *DomainRepo) GetByName(ctx context.Context, name, tenantID string) (*entity.Domain, error)
- func (r *DomainRepo) GetCount(ctx context.Context, tenantID string) (int, error)
- func (r *DomainRepo) GetDomainByDomainSuffix(ctx context.Context, domainSuffix, tenantID string) (*entity.Domain, error)
- func (r *DomainRepo) Insert(ctx context.Context, d *entity.Domain) (string, error)
- func (r *DomainRepo) Update(ctx context.Context, d *entity.Domain) (bool, error)
- type IEEE8021xRepo
- func (r *IEEE8021xRepo) CheckProfileExists(ctx context.Context, profileName, tenantID string) (bool, error)
- func (r *IEEE8021xRepo) Delete(ctx context.Context, profileName, tenantID string) (bool, error)
- func (r *IEEE8021xRepo) Get(ctx context.Context, top, skip int, tenantID string) ([]entity.IEEE8021xConfig, error)
- func (r *IEEE8021xRepo) GetByName(ctx context.Context, profileName, tenantID string) (*entity.IEEE8021xConfig, error)
- func (r *IEEE8021xRepo) GetCount(ctx context.Context, tenantID string) (int, error)
- func (r *IEEE8021xRepo) Insert(ctx context.Context, c *entity.IEEE8021xConfig) (string, error)
- func (r *IEEE8021xRepo) Update(ctx context.Context, c *entity.IEEE8021xConfig) (bool, error)
- type ProfileRepo
- func (r *ProfileRepo) Delete(ctx context.Context, profileName, tenantID string) (bool, error)
- func (r *ProfileRepo) Get(ctx context.Context, top, skip int, tenantID string) ([]entity.Profile, error)
- func (r *ProfileRepo) GetByName(ctx context.Context, profileName, tenantID string) (*entity.Profile, error)
- func (r *ProfileRepo) GetCount(ctx context.Context, tenantID string) (int, error)
- func (r *ProfileRepo) Insert(ctx context.Context, p *entity.Profile) (string, error)
- func (r *ProfileRepo) Update(ctx context.Context, p *entity.Profile) (bool, error)
- type ProfileWiFiConfigsRepo
- func (r *ProfileWiFiConfigsRepo) DeleteByProfileName(ctx context.Context, profileName, tenantID string) (bool, error)
- func (r *ProfileWiFiConfigsRepo) GetByProfileName(ctx context.Context, profileName, tenantID string) ([]entity.ProfileWiFiConfigs, error)
- func (r *ProfileWiFiConfigsRepo) Insert(ctx context.Context, p *entity.ProfileWiFiConfigs) (string, error)
- type WirelessRepo
- func (r *WirelessRepo) CheckProfileExists(ctx context.Context, profileName, tenantID string) (bool, error)
- func (r *WirelessRepo) Delete(ctx context.Context, profileName, tenantID string) (bool, error)
- func (r *WirelessRepo) Get(ctx context.Context, top, skip int, tenantID string) ([]entity.WirelessConfig, error)
- func (r *WirelessRepo) GetByName(ctx context.Context, profileName, tenantID string) (*entity.WirelessConfig, error)
- func (r *WirelessRepo) GetCount(ctx context.Context, tenantID string) (int, error)
- func (r *WirelessRepo) Insert(ctx context.Context, w *entity.WirelessConfig) (string, error)
- func (r *WirelessRepo) Update(ctx context.Context, w *entity.WirelessConfig) (bool, error)
Constants ¶
View Source
const ( CollectionDevices = "devices" CollectionProfiles = "profiles" CollectionCIRAConfigs = "ciraconfigs" CollectionDomains = "domains" CollectionIEEE8021xConfigs = "ieee8021xconfigs" CollectionWirelessConfigs = "wirelessconfigs" CollectionProfileWiFiConfigs = "profiles_wirelessconfigs" )
View Source
const DatabaseName = "consoledb"
View Source
const DefaultTop = 100
DefaultTop is the page size used when a caller passes top<=0 (mirrors sqldb).
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CIRARepo ¶
type CIRARepo struct {
// contains filtered or unexported fields
}
func NewCIRARepo ¶
type DeviceRepo ¶
type DeviceRepo struct {
// contains filtered or unexported fields
}
func NewDeviceRepo ¶
func NewDeviceRepo(db *mongo.Database) *DeviceRepo
func (*DeviceRepo) GetByColumn ¶
func (*DeviceRepo) GetDistinctTags ¶
func (*DeviceRepo) UpdateConnectionStatus ¶
func (*DeviceRepo) UpdateLastSeen ¶
func (r *DeviceRepo) UpdateLastSeen(ctx context.Context, guid string) error
type DomainRepo ¶
type DomainRepo struct {
// contains filtered or unexported fields
}
func NewDomainRepo ¶
func NewDomainRepo(db *mongo.Database) *DomainRepo
func (*DomainRepo) GetDomainByDomainSuffix ¶
type IEEE8021xRepo ¶
type IEEE8021xRepo struct {
// contains filtered or unexported fields
}
func NewIEEE8021xRepo ¶
func NewIEEE8021xRepo(db *mongo.Database) *IEEE8021xRepo
func (*IEEE8021xRepo) CheckProfileExists ¶
func (*IEEE8021xRepo) Get ¶
func (r *IEEE8021xRepo) Get(ctx context.Context, top, skip int, tenantID string) ([]entity.IEEE8021xConfig, error)
func (*IEEE8021xRepo) GetByName ¶
func (r *IEEE8021xRepo) GetByName(ctx context.Context, profileName, tenantID string) (*entity.IEEE8021xConfig, error)
func (*IEEE8021xRepo) Insert ¶
func (r *IEEE8021xRepo) Insert(ctx context.Context, c *entity.IEEE8021xConfig) (string, error)
func (*IEEE8021xRepo) Update ¶
func (r *IEEE8021xRepo) Update(ctx context.Context, c *entity.IEEE8021xConfig) (bool, error)
type ProfileRepo ¶
type ProfileRepo struct {
// contains filtered or unexported fields
}
func NewProfileRepo ¶
func NewProfileRepo(db *mongo.Database, log logger.Interface) *ProfileRepo
type ProfileWiFiConfigsRepo ¶
type ProfileWiFiConfigsRepo struct {
// contains filtered or unexported fields
}
func NewProfileWiFiConfigsRepo ¶
func NewProfileWiFiConfigsRepo(db *mongo.Database) *ProfileWiFiConfigsRepo
func (*ProfileWiFiConfigsRepo) DeleteByProfileName ¶
func (*ProfileWiFiConfigsRepo) GetByProfileName ¶
func (r *ProfileWiFiConfigsRepo) GetByProfileName(ctx context.Context, profileName, tenantID string) ([]entity.ProfileWiFiConfigs, error)
func (*ProfileWiFiConfigsRepo) Insert ¶
func (r *ProfileWiFiConfigsRepo) Insert(ctx context.Context, p *entity.ProfileWiFiConfigs) (string, error)
type WirelessRepo ¶
type WirelessRepo struct {
// contains filtered or unexported fields
}
func NewWirelessRepo ¶
func NewWirelessRepo(db *mongo.Database, log logger.Interface) *WirelessRepo
func (*WirelessRepo) CheckProfileExists ¶
func (*WirelessRepo) Get ¶
func (r *WirelessRepo) Get(ctx context.Context, top, skip int, tenantID string) ([]entity.WirelessConfig, error)
func (*WirelessRepo) GetByName ¶
func (r *WirelessRepo) GetByName(ctx context.Context, profileName, tenantID string) (*entity.WirelessConfig, error)
func (*WirelessRepo) Insert ¶
func (r *WirelessRepo) Insert(ctx context.Context, w *entity.WirelessConfig) (string, error)
func (*WirelessRepo) Update ¶
func (r *WirelessRepo) Update(ctx context.Context, w *entity.WirelessConfig) (bool, error)
Click to show internal directories.
Click to hide internal directories.