projects

package
v1.0.6-1 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2020 License: Apache-2.0 Imports: 6 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExistsWithName

func ExistsWithName(name string, store stores.Store) bool

ExistsWithName returns true if a project with name exists

func ExistsWithUUID

func ExistsWithUUID(uuid string, store stores.Store) bool

ExistsWithUUID return true if a project with uuid exists

func GetNameByUUID

func GetNameByUUID(uuid string, store stores.Store) string

GetNameByUUID queries projects by UUID and returns the project name. If not found, returns an empty string

func GetUUIDByName

func GetUUIDByName(name string, store stores.Store) string

GetUUIDByName queries project by name and returns the corresponding UUID

func HasProject

func HasProject(name string, store stores.Store) bool

HasProject if store contains a project with the specific name

func RemoveProject

func RemoveProject(uuid string, store stores.Store) error

RemoveProject removes project

Types

type Project

type Project struct {
	UUID        string `json:"-"`
	Name        string `json:"name,omitempty"`
	CreatedOn   string `json:"created_on,omitempty"`
	ModifiedOn  string `json:"modified_on,omitempty"`
	CreatedBy   string `json:"created_by,omitempty"`
	Description string `json:"description,omitempty"`
}

ProjectUUID is the struct that holds ProjectUUID information

func CreateProject

func CreateProject(uuid string, name string, createdOn time.Time, createdBy string, description string, store stores.Store) (Project, error)

CreateProject creates a new project

func GetFromJSON

func GetFromJSON(input []byte) (Project, error)

GetFromJSON retrieves ProjectUUID info From JSON string

func NewProject

func NewProject(uuid string, name string, createdOn time.Time, modifiedOn time.Time, createdBy string, description string) Project

NewProject accepts parameters and creates a new project

func UpdateProject

func UpdateProject(uuid string, name string, description string, modifiedOn time.Time, store stores.Store) (Project, error)

UpdateProject creates a new project

func (*Project) ExportJSON

func (p *Project) ExportJSON() (string, error)

ExportJSON exports ProjectUUID to json format

type ProjectMessageCount

type ProjectMessageCount struct {
	Project              string  `json:"project"`
	MessageCount         int64   `json:"message_count"`
	AverageDailyMessages float64 `json:"average_daily_messages"`
}

type Projects

type Projects struct {
	List []Project `json:"projects,omitempty"`
}

Projects holds a list of available projects

func Find

func Find(uuid string, name string, store stores.Store) (Projects, error)

Find returns a specific project or a list of all available projects in the datastore. To return all projects use an empty project string parameter

func (*Projects) Empty

func (ps *Projects) Empty() bool

Empty returns true if projects list is empty

func (*Projects) ExportJSON

func (ps *Projects) ExportJSON() (string, error)

ExportJSON exports Projects list to json format

func (*Projects) One

func (ps *Projects) One() Project

One returns the first project if a projects list is not empty

type TotalProjectsMessageCount

type TotalProjectsMessageCount struct {
	Projects             []ProjectMessageCount `json:"projects"`
	TotalCount           int64                 `json:"total_message_count"`
	AverageDailyMessages float64               `json:"average_daily_messages"`
}

func GetProjectsMessageCount

func GetProjectsMessageCount(projects []string, startDate time.Time, endDate time.Time, str stores.Store) (TotalProjectsMessageCount, error)

GetProjectsMessageCount returns the total amount of messages per project for the given time window

Jump to

Keyboard shortcuts

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