validate

package
v0.11.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CustomCSS added in v0.5.0

func CustomCSS(customCSS string) error

func DisplayName

func DisplayName(displayName string) error

DisplayName checks that a requested display name is valid

func Email

func Email(email string) error

Email makes sure that a given email address is a valid address. Returns an error if not.

func EmojiCategory added in v0.6.0

func EmojiCategory(category string) error

EmojiCategory validates the length of the given category string.

func EmojiShortcode

func EmojiShortcode(shortcode string) error

EmojiShortcode just runs the given shortcode through the regular expression for emoji shortcodes, to figure out whether it's a valid shortcode, ie., 2-30 characters, a-zA-Z, numbers, and underscores.

func Language

func Language(lang string) (string, error)

Language checks that the given language string is a valid, if not necessarily canonical, BCP 47 language tag. Returns a canonicalized version of the tag if the language can be parsed. Returns an error if the language cannot be parsed. See: https://pkg.go.dev/golang.org/x/text/language

func ListRepliesPolicy added in v0.10.0

func ListRepliesPolicy(repliesPolicy gtsmodel.RepliesPolicy) error

ListRepliesPolicy validates the replies_policy of a new or updated list.

func ListTitle added in v0.10.0

func ListTitle(title string) error

ListTitle validates the title of a new or updated List.

func MarkerName added in v0.11.0

func MarkerName(name string) error

MarkerName checks that the desired marker timeline name is valid.

func Note

func Note(note string) error

Note checks that a given profile/account note/bio is valid

func Password added in v0.11.0

func Password(password string) error

Password returns a helpful error if the given password is too short, too long, or not sufficiently strong.

func Privacy

func Privacy(privacy string) error

Privacy checks that the desired privacy setting is valid

func ProfileFields added in v0.9.0

func ProfileFields(fields []*gtsmodel.Field) error

ProfileFields validates the length of provided fields slice, and also iterates through the fields and trims each name + value to maximumProfileFieldLength, if they were above.

func SignUpReason

func SignUpReason(reason string, reasonRequired bool) error

SignUpReason checks that a sufficient reason is given for a server signup request

func SiteDescription

func SiteDescription(d string) error

SiteDescription ensures that the given site description is within spec.

func SiteShortDescription

func SiteShortDescription(d string) error

SiteShortDescription ensures that the given site short description is within spec.

func SiteTerms

func SiteTerms(t string) error

SiteTerms ensures that the given site terms string is within spec.

func SiteTitle

func SiteTitle(siteTitle string) error

SiteTitle ensures that the given site title is within spec.

func StatusContentType added in v0.8.0

func StatusContentType(statusContentType string) error

StatusContentType checks that the desired status format setting is valid.

func ULID

func ULID(i string) bool

ULID returns true if the passed string is a valid ULID.

func Username

func Username(username string) error

Username makes sure that a given username is valid (ie., letters, numbers, underscores, check length). Returns an error if not.

Types

This section is empty.

Jump to

Keyboard shortcuts

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