utils

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActivityAPILink(activity arn.Activity) string

ActivityAPILink returns the API link for any activity.

func AllowEmbed

func AllowEmbed(ctx *aero.Context, response string) string

AllowEmbed allows the page to be called by the browser extension.

func CutLongDescription

func CutLongDescription(description string) string

CutLongDescription cuts a long description for use in OpenGraph tags.

func EmptyImage

func EmptyImage() string

EmptyImage returns the smallest possible 1x1 pixel image encoded in Base64.

func FormatRating

func FormatRating(rating float64) string

FormatRating formats the rating number.

func GetContainerClass

func GetContainerClass(ctx *aero.Context) string

GetContainerClass returns the class for the "container" element. In the browser extension it will get the "embedded" class.

func GetUser

func GetUser(ctx *aero.Context) *arn.User

GetUser returns the logged in user for the given context.

func HashString

func HashString(item string) uint64

HashString returns a hash of the string.

func HashStringsNoOrder

func HashStringsNoOrder(items []string) uint64

HashStringsNoOrder returns a hash of the string slice contents, ignoring order.

func Icon

func Icon(name string) string

Icon ...

func Intersection

func Intersection(a []string, b []string) []string

Intersection returns common elements of a and b.

func MaxAnime

func MaxAnime(animes []*arn.Anime, maxLength int) []*arn.Anime

MaxAnime limits the number of anime that will maximally be returned.

func RawIcon

func RawIcon(name string) string

RawIcon ...

func RenderQuoteText

func RenderQuoteText(text string) string

RenderQuoteText renders the given quote text.

func SVGSlicePath

func SVGSlicePath(from float64, to float64) string

SVGSlicePath creates a path string for a slice in a pie chart.

func SameUser

func SameUser(a *arn.User, b *arn.User) string

SameUser returns "true" or "false" depending on if the users are the same.

func SearchClass

func SearchClass(results interface{}) string

SearchClass returns the class for a search section depending on the length of the search results.

func SmartRedirect

func SmartRedirect(ctx *aero.Context, uri string) string

SmartRedirect automatically adds the /_ prefix to the URI if required.

func YenToUserCurrency

func YenToUserCurrency(amount int, user *arn.User) string

YenToUserCurrency converts the Yen price to the user currency.

Types

type APIField

type APIField struct {
	Name string
	JSON string
	Type string
}

APIField describes a field in the API.

type AnimeWithRelatedAnime

type AnimeWithRelatedAnime struct {
	Anime   *arn.Anime
	Related *arn.Anime
}

AnimeWithRelatedAnime ...

type CalendarDay

type CalendarDay struct {
	Name    string
	Class   string
	Entries []*CalendarEntry
}

CalendarDay is a calendar day.

type CalendarEntry

type CalendarEntry struct {
	Anime   *arn.Anime
	Episode *arn.AnimeEpisode
	Added   bool
}

CalendarEntry is a calendar entry.

type Comparison

type Comparison struct {
	Anime *arn.Anime
	ItemA *arn.AnimeListItem
	ItemB *arn.AnimeListItem
}

Comparison of an anime between 2 users.

type HallOfFameEntry

type HallOfFameEntry struct {
	Year  int
	Anime *arn.Anime
}

HallOfFameEntry is an entry in the hall of fame.

type JobInfo

type JobInfo struct {
	Name         string
	LastStarted  time.Time
	LastFinished time.Time
}

JobInfo gives you information about a background job.

func (*JobInfo) IsRunning

func (job *JobInfo) IsRunning() bool

IsRunning tells you whether the given job is running or not.

func (*JobInfo) Start

func (job *JobInfo) Start() error

Start will start the job.

type MALComparison

type MALComparison struct {
	Anime       *arn.Anime
	MALAnime    *mal.Anime
	Differences []animediff.Difference
}

MALComparison encapsulates the difference between an ARN anime and a MAL anime.

type UserList

type UserList struct {
	Name  string
	Users []*arn.User
}

UserList is a named list of users.

type UserStats

type UserStats struct {
	AnimeWatchingTime time.Duration
	PieCharts         []*arn.PieChart
}

UserStats ...

type YearRegistrations

type YearRegistrations struct {
	Total  int
	Months map[int]int
}

YearRegistrations describes how many user registrations happened in a year.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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