status

package
v0.0.0-...-9ad353d Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2020 License: MIT Imports: 0 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NormalOrBannedService = &PlainService{
	AvailableStatuses: map[Status]bool{StatusNormal: true},
	StatusLabels:      map[Status]string{StatusNormal: StatusLabelNormal, StatusBanned: StatusLabelBanned},
}

NormalOrBannedService service only contains status normal and banned.

View Source
var StatusBanned = Status(-1)

StatusBanned user status banned

View Source
var StatusLabelBanned = "banned"

StatusLabelBanned status label for banned

View Source
var StatusLabelNormal = "normal"

StatusLabelNormal status label for normal

View Source
var StatusNormal = Status(1)

StatusNormal user status normal

View Source
var StatusUnkown = Status(0)

Functions

This section is empty.

Types

type PlainService

type PlainService struct {
	//AvailableStatuses available statuses map
	AvailableStatuses map[Status]bool
	//StatusLabels status labels map
	StatusLabels map[Status]string
}

PlainService plain service type

func NewService

func NewService() *PlainService

NewService create new service

func (*PlainService) IsAvailable

func (p *PlainService) IsAvailable(s Status) (bool, error)

IsAvailable check is status available

func (*PlainService) Label

func (p *PlainService) Label(s Status) (string, error)

Label get status label

type Service

type Service interface {
	//IsAvailable check is status available
	IsAvailable(Status) (bool, error)
	//Label get status label
	//Empty string will be returned if status invalid
	Label(Status) (string, error)
}

Service user status service interface

type Status

type Status int

Status user status type

Jump to

Keyboard shortcuts

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