topics

package
v0.0.0-...-c528213 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Provides methods for creating and modifying preferenfes

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddChannel

func AddChannel(ident, channelName, user, organization string) error

AddChannel enables the channel for that particular ident for sending notifications

func ChannelAllowed

func ChannelAllowed(user, org, app_name, ident, channelName string) bool

ChannelAllowed checks if the requested channel is allowed by the user for sending out the notification

func DisableUserChannel

func DisableUserChannel(orgs, topics []string, user, channelName string)

func Get

func Get(user, org, topicName string) (topic *db.Topic, err error)

func GetAllDefault

func GetAllDefault(org string) []db.Topic

GetAllDefault returns all the "default - non-enabled" preferences for the organization

func Initialize

func Initialize(user, org string) error

Initialize creates a list of "default - non-enabled" preferences for user or org

func Insert

func Insert(topic *db.Topic) string

Insert adds a new user or organization preference

func InsertOrUpdateTopic

func InsertOrUpdateTopic(org, ident, channelName, attr string, val bool, user string) error

InsertOrUpdateTopic adds a topic in `topics` collection if it doesn't exist Or it update the topic if it exists

This is not a very effecient way of doing it but we are doing it at the cost of the data structure we want.

One of the limitations is that mongo is not yet capable of upserting to array of documents. For this to happen in a simple way the data structure has to change from channels: []Channel to channels: map[string]interface

func RemoveChannel

func RemoveChannel(ident, channelName, user, organization string) error

RemoveChannel disables the channel for that particular ident for sending notifications

Types

This section is empty.

Jump to

Keyboard shortcuts

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