armies

package
v0.0.0-...-448f6b4 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: MIT Imports: 10 Imported by: 0

README

armies

import "github.com/brittonhayes/warhammer-aos/pkg/armies"

package armies contains the types, methods, and interfaces for interacting with Warhammer Age of Sigmar Armies

Index

func Handler

func Handler() func(ctx *fiber.Ctx) error

Handler returns an http response all of the armies as a JSON

type Ability

Ability is a skill possessed by the parent unit

type Ability struct {
    Name string `json:"name"`
    Desc string `json:"desc"`
}

type Armies

Armies is a helper type to allow receiver methods for a slice of Army

type Armies []Army
Example

Create a new handler and add a function to the route

package main

import (
	"github.com/brittonhayes/warhammer-aos/internal/handlers"
	"github.com/brittonhayes/warhammer-aos/pkg/armies"
)

func main() {
	_ = handlers.New().AddRoute("*", armies.Handler()).Build()
}

func (*Armies) Reply
func (a *Armies) Reply() *handlers.Response

Reply returns a list of armies formatted as an API response

type Army

Army is the parent structure that all nested units belong to

type Army struct {
    Army  string `json:"army"`
    Units []Unit `json:"units"`
}
func (*Army) Reply
func (a *Army) Reply() *handlers.Response

Reply returns an army formatted as an API response

func (*Army) Unit
func (a *Army) Unit(name string) string

type MeleeWeapon

MeleeWeapon is a weapon that is used for close quarters combat

type MeleeWeapon struct {
    Name    string `json:"name"`
    Range   string `json:"range"`
    Attacks string `json:"attacks"`
    ToHit   string `json:"to_hit"`
    ToWound string `json:"to_wound"`
    Rend    string `json:"rend"`
    Damage  string `json:"damage"`
}

type MissileWeapon

MissileWeapon is a weapon that is used for ranged attacks

type MissileWeapon struct {
    Name    string `json:"name"`
    Range   string `json:"range"`
    Attacks string `json:"attacks"`
    ToHit   string `json:"to_hit"`
    ToWound string `json:"to_wound"`
    Rend    string `json:"rend"`
    Damage  string `json:"damage"`
}

type Service

Service covers all available methods of the Armies package

type Service interface {
    Reply() *handlers.Response
}

type Unit

Unit is an individual unit in Warhammer

type Unit struct {
    Name string `json:"name"`
    Size string `json:"size"`
}

Generated by gomarkdoc

Documentation

Overview

package armies contains the types, methods, and interfaces for interacting with Warhammer Age of Sigmar Armies

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = map[string]string{"message": "Resource could not be found"}
)

Functions

func Find

func Find() func(ctx *fiber.Ctx) error

Find returns an http response all of the armies as a JSON

func List

func List() func(ctx *fiber.Ctx) error

List returns an http response all of the armies as a JSON

Types

type Ability

type Ability struct {
	Name string `json:"name"`
	Desc string `json:"desc"`
}

Ability is a skill possessed by the parent unit

type Armies

type Armies []Army

Armies is a helper type to allow receiver methods for a slice of Army

Example

Create a new handler and add a function to the route

package main

import (
	"github.com/brittonhayes/warhammer-aos/internal/handlers"
	"github.com/brittonhayes/warhammer-aos/pkg/armies"
)

func main() {
	_ = handlers.New().AddRoute("*", armies.List()).Build()
}
Output:

type Army

type Army struct {
	Army  string `json:"army"`
	Units []Unit `json:"units"`
}

Army is the parent structure that all nested units belong to

type MeleeWeapon

type MeleeWeapon struct {
	Name    string `json:"name"`
	Range   string `json:"range"`
	Attacks string `json:"attacks"`
	ToHit   string `json:"to_hit"`
	ToWound string `json:"to_wound"`
	Rend    string `json:"rend"`
	Damage  string `json:"damage"`
}

MeleeWeapon is a weapon that is used for close quarters combat

type MissileWeapon

type MissileWeapon struct {
	Name    string `json:"name"`
	Range   string `json:"range"`
	Attacks string `json:"attacks"`
	ToHit   string `json:"to_hit"`
	ToWound string `json:"to_wound"`
	Rend    string `json:"rend"`
	Damage  string `json:"damage"`
}

MissileWeapon is a weapon that is used for ranged attacks

type Service

type Service interface {
	// contains filtered or unexported methods
}

Service covers all available methods of the Armies package

type Unit

type Unit struct {
	Name          string          `json:"name"`
	Size          string          `json:"size"`
	Move          string          `json:"move"`
	Save          string          `json:"save"`
	Bravery       string          `json:"bravery"`
	Wounds        string          `json:"wounds"`
	MissileWeapon []MissileWeapon `json:"missile_weapon,omitempty"`
	MeleeWeapon   []MissileWeapon `json:"melee_weapon,omitempty"`
	Abilities     []Ability       `json:"abilities"`
	Keywords      []string        `json:"keywords"`
}

Unit is an individual unit in Warhammer

Jump to

Keyboard shortcuts

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