role

package
v1.11.13 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package role handles the job or activity a person was credited with.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRenAll    = errors.New("cannot rename everyone, only people tied to specific roles can be renamed")
	ErrNoName    = errors.New("a name of the person must be provided")
	ErrNoReplace = errors.New("a replacement name must be provided")
	ErrRole      = errors.New("unknown role")
)

Functions

func Clean

func Clean(db *sql.DB, w io.Writer, name string, r Role) (bool, error)

Clean and save a malformed name.

func CleanS

func CleanS(s string) string

CleanS separates and fixes the substrings of s.

func List

func List(db *sql.DB, w io.Writer, role Role) ([]string, int, error)

List people filtered by a role.

func PeopleStmt

func PeopleStmt(role Role, softDel bool) string

PeopleStmt returns a complete SQL WHERE statement for people that are filtered by roles.

func Rename

func Rename(db *sql.DB, replacement, name string, r Role) (int64, error)

Rename replaces the persons using name with the replacement. The task must be limited names associated to a Role.

func Trim

func Trim(s string) string

Trim fixes any malformed strings.

Types

type Role

type Role int

Role are jobs that categorize persons.

const (
	Everyone  Role = iota // Everyone displays all people.
	Artists               // Artists are graphic or video.
	Coders                // Coders are programmers.
	Musicians             // Musicians create music or audio.
	Writers               // Writers for the documents.
)

func Roles

func Roles(r string) Role

func (Role) String

func (r Role) String() string

Jump to

Keyboard shortcuts

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