validate

package
v0.0.26 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

validate contains validation logic that should be run before DB calls are made.

Index

Constants

View Source
const MaxDescriptionLength = 4096
View Source
const MaxNameLength = 2048
View Source
const MaxTagLength = 128
View Source
const MaxTags = 24
View Source
const MaxURLLength = 2048
View Source
const MinQueryLength = 3

Variables

This section is empty.

Functions

func BookID

func BookID(tx db.Transaction, ID string) error

BookID validates a bookmark ID value. The target bookmark must exist.

func Description

func Description(description null.NullString) error

Description validates a description value. IT's optional and must have a length <= 5096.

func Direction

func Direction(direction armaria.Direction) error

Direction validates a direction value. It must be asc or desc.

func First

func First(limit null.NullInt64) error

First validates a limit value. It's optional, but if it is provided it must be > 0.

func Name

func Name(name null.NullString) error

Name validates a name value. It's required and must have a length >= 1 and <= 1024.

func Order

func Order(order armaria.Order) error

Order validates an order value. It must be modified or name.

func Ordering added in v0.0.22

func Ordering(tx db.Transaction, previousID null.NullString, nextID null.NullString) (string, error)

Ordering validates the values used for manual ordering. The previousBook value must be < the nextBook value.

func ParentID

func ParentID(tx db.Transaction, parentID null.NullString) error

ParentID validates a parent ID value. It's optional but if it is provided the target parent folder must exist.

func Query

func Query(query null.NullString) error

Query validates a query value. It's optional must be at least 3 chars long.

func Tags

func Tags(tags []string, existingTags []string) error

Tags validates a tags value. They must be unique. Each must have a length >= 1 and <= 128. Each must be comprised of the chars A-Z a-z 0-9 - _

func URL

func URL(URL null.NullString) error

URL validates a URL value. It's only used for bookmarks and must have a length >= 1 and <= 2048.

Types

This section is empty.

Jump to

Keyboard shortcuts

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