models

package
v1.0.77 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StandardTags = map[Slug]string{}/* 115 elements not displayed */

Functions

func SanitizeName

func SanitizeName(name string) string

SanitizeName sanitizes the given tag to be used as a name (removes non-ASCII, trims trailing spaces, and titles)

func TagsToNames

func TagsToNames(tags []Tag) []string

TagsToNames get a slice of tag names from a slice of tags

Types

type CardInfo

type CardInfo struct {
	NormalizedURL string
	DirectURL     string
	PlatformID    string
	CharacterID   string
	Name          string
	Title         string
	Tagline       string
	CreateTime    timestamp.Nano
	UpdateTime    timestamp.Nano
	IsForked      bool
	Tags          []Tag
}

CardInfo struct for storing card information

func (*CardInfo) NormalizeSymbols

func (c *CardInfo) NormalizeSymbols()

NormalizeSymbols trims whitespace from Name and Title and normalizes symbols in Tagline

type CreatorInfo

type CreatorInfo struct {
	Nickname   string
	Username   string
	PlatformID string
}

CreatorInfo struct for storing creator information

type Metadata

type Metadata struct {
	Source source.ID
	CardInfo
	CreatorInfo
	BookUpdateTime timestamp.Nano
	GreetingsCount int
	HasBook        bool
}

Metadata struct for storing card metadata

func (*Metadata) Clone

func (m *Metadata) Clone() *Metadata

Clone returns a deep copy of the Metadata struct

func (*Metadata) Integrity

func (m *Metadata) Integrity() bool

Integrity checks if the metadata is valid

func (*Metadata) IsConsistentWith

func (m *Metadata) IsConsistentWith(card *character.Sheet) bool

IsConsistentWith checks if the metadata is consistent with the card

func (*Metadata) LatestUpdateTime

func (m *Metadata) LatestUpdateTime() timestamp.Nano

LatestUpdateTime returns the latest update time of the card

type Slug

type Slug = string

Slug type representing a tag slug

func SanitizeSlug

func SanitizeSlug(slug Slug) Slug

SanitizeSlug sanitizes the given tag to be used as a slug (removes non-ASCII, '-', '_', whitespace and lowers all characters)

func TagsToSlugs

func TagsToSlugs(tags []Tag) []Slug

TagsToSlugs get a slice of tag slugs from a slice of tags

type Tag

type Tag struct {
	Slug Slug
	Name string
}

Tag struct representing a tag

func ResolveTag

func ResolveTag(stringTag string) Tag

ResolveTag resolves a tag string into a Tag struct.

func TagsFromJsonArray

func TagsFromJsonArray(array *sonicx.Wrap, extractor func(result *sonicx.Wrap) string) []Tag

TagsFromJsonArray extracts tags from a JSON array

func TagsFromMap

func TagsFromMap(tags map[Slug]string) []Tag

TagsFromMap transforms a map into a list of Tags (no sanitization will be applied)

Jump to

Keyboard shortcuts

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