model

package
v0.0.0-...-72c2fff Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2019 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxNameSize = 22
)

MaxNameSize is the max number of characters for a container name.

Variables

View Source
var Admins []Admin

Admins is a list of admins for this Team

Functions

func IsAdmin

func IsAdmin(userName string) bool

IsAdmin checks if the given userid is Superuser or listed as admin

func LoadAdmins

func LoadAdmins(bot *slacker.Slacker)

LoadAdmins will load the current slack team admins to be used on admin-only commands

Types

type Admin

type Admin struct {
	ID       string
	RealName string
}

Admin is the model representing a Team admin

type Command

type Command struct {
	Usage       string
	Description string
	Handler     func(request *slacker.Request, response slacker.ResponseWriter)
}

Command defines a command to be register to slack

type Container

type Container struct {
	gorm.Model
	TeamID         string `gorm:"not null"`
	ChannelID      string `gorm:"not null"`
	Name           string `gorm:"not null"`
	InUseBy        string
	InUseForReason string
	CreatedByUser  string
}

Container defines the Container information on database.

func GetContainer

func GetContainer(teamID string, channelID string, name string) (Container, error)

GetContainer returns a container for teamID, channelID, and name provided

func GetContainers

func GetContainers(teamID string, channelID string) ([]Container, error)

GetContainers returns a list of containers for the given TeamID and ChannelID

func (Container) Add

func (container Container) Add() error

Add a given Container to database

func (Container) ClearInUse

func (container Container) ClearInUse() error

ClearInUse removes information InUseBy and InUseForReason

func (Container) Delete

func (container Container) Delete() error

Delete removes a Container from the database

func (Container) InUseText

func (container Container) InUseText(format string) string

InUseText returns Available or Free for format=Simple, and Available or InUseBy and InUseForReason for format=Full

func (Container) SetInUse

func (container Container) SetInUse(by string, reason string) error

SetInUse sets information InUseBy and InUseForReason

func (Container) Update

func (container Container) Update() error

Update a given Container

Jump to

Keyboard shortcuts

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