appconfigs

package
v0.0.0-...-d40265a Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FlagFunnel   = "funnel"
	FlagCampaign = "campaign"
	FlagBtnTime  = "btntime"
)

Variables

View Source
var (
	ErrInvalidFlag       = fmt.Errorf("provided config-flag is invalid")
	ErrNoReadWriteAccess = fmt.Errorf("user read/write access for AppToken")
	ErrNoReadAccess      = fmt.Errorf("user has no read access for AppToken")

	ErrInvalidRegex = fmt.Errorf("provided stage-regex is not a regex")
)

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	AppUuid     string   `bson:"_id"`
	ConfigOwner string   `bson:"config_owner"`
	OwnerOrgn   string   `bson:"owner_orgn"`
	IsPrivate   bool     `bson:"is_private"`
	Member      []string `bson:"member"`
	Locked      bool     `bson:"locked"`
	Funnel      []Stage  `bson:"funnel"`
	Campaign    []Record `bson:"campaign"`
	BtnTime     []BtnDef `bson:"btntime"`
}

func NewDefault

func NewDefault(appRefUuid, configOwner, ownerOrgn string, isPrivate bool) *AppConfig

NewDefault creates a new AppConfig with only meta data

func (*AppConfig) AddMember

func (appConf *AppConfig) AddMember(userUuid string)

AddMember appends the member list of an AppConfig. Skips operation if already exists

func (*AppConfig) ApplyBtnTime

func (appConf *AppConfig) ApplyBtnTime(btnDefs ...BtnDef)

func (*AppConfig) ApplyCampaign

func (appConf *AppConfig) ApplyCampaign(records ...Record)

func (*AppConfig) ApplyFunnel

func (appConf *AppConfig) ApplyFunnel(stages ...Stage) error

func (AppConfig) HasRead

func (appConfig AppConfig) HasRead(userUuid string, userOrgn string) error

HasRead checks if the user has read access on the AppToken

func (AppConfig) HasReadOrWrite

func (appConfig AppConfig) HasReadOrWrite(userUuid string, userOrgn string) error

HasReadOrWrite checks if the user has either read or write acces on the AppToken

func (AppConfig) HasReadWrite

func (appConfig AppConfig) HasReadWrite(userUuid string) error

HasReadWrite checks if the provided user uuid is listed as owner of AppToken

type AppconfigRepo

type AppconfigRepo interface {
	Initialize(ctx context.Context, appConfig AppConfig) error
	GetById(ctx context.Context, uuid string, result interface{}) error
	UpdateByFlag(ctx context.Context, uuid, flag string, data interface{}) error

	AddMember(ctx context.Context, uuid, userUuid string) error
	RollbackAddMember(ctx context.Context, uuid, userUuid string) error

	SetAppConfigLock(ctx context.Context, uuid string, lock bool) error
}

type BtnDef

type BtnDef struct {
	Id      int32  `bson:"id"`
	Name    string `bson:"name"`
	BtnName string `bson:"btn_name"`
}

type Record

type Record struct {
	Id     int32  `bson:"id"`
	Name   string `bson:"name"`
	Suffix string `bson:"suffix"`
}

type Stage

type Stage struct {
	Id         int32  `bson:"id"`
	Name       string `bson:"name"`
	Transition string `bson:"transition"`
	Regex      string `bson:"regex"`
	Trigger    int32  `bson:"trigger"`
}

Directories

Path Synopsis
storage

Jump to

Keyboard shortcuts

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