profession

package
v0.0.0-...-a30bc99 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package profession provides fantasy professions and metadata for them

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Names

func Names(professions []Profession) []string

Names returns a slice of just the names of a list of professions

Types

type Data

type Data struct {
	Professions []Profession `json:"professions"`
}

Data is a struct containing a slice of professions

type Profession

type Profession struct {
	Name        string   `json:"name" db:"name"`
	Description string   `json:"description" db:"description"`
	Tags        []string `json:"tags"`
}

Profession is a person with a particular skillset that can make a resource

func All

func All() ([]Profession, error)

All returns all professions

func ByName

func ByName(name string) (Profession, error)

ByName returns a profession by name

func ByTag

func ByTag(tag string) ([]Profession, error)

ByTag returns a slice of professions that have the given tag

func Random

func Random() (Profession, error)

Random returns a single random profession from all professions

func RandomSet

func RandomSet(max int, possible []Profession) ([]Profession, error)

RandomSet returns a random number of professions from a given set of professions

func (Profession) HasTag

func (profession Profession) HasTag(tag string) bool

HasTag returns true if the profession has a given tag

func (Profession) InSlice

func (profession Profession) InSlice(professions []Profession) bool

InSlice returns true if the given profession is in the slice

Jump to

Keyboard shortcuts

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