request

package
v0.0.0-...-de8f578 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const SPLIT_DIFFICULTY = "-"
View Source
const SPLIT_QUERY = ":"

Variables

This section is empty.

Functions

func GetUserID

func GetUserID(ctx context.Context) (string, error)

GetUserID reads user id string from request context

func IsValidName

func IsValidName(name string) bool

IsValidName validates the name is only number and alphabets.

Types

type ContextKey

type ContextKey int

ContextKey is type for read/write context

const CtxUserID ContextKey = 1

CtxUserID is context key for getting id

type SearchFilter

type SearchFilter struct {
	Difficulty  SearchFilterDifficulty
	Genre       SearchFilterGenre
	UserID      string
	Keyword     string
	Public      bool
	ForcePublic bool
}

type SearchFilterDifficulty

type SearchFilterDifficulty [2]int

type SearchFilterGenre

type SearchFilterGenre string
const (
	GENRE_ALL      SearchFilterGenre = ""
	GENRE_GENERAL  SearchFilterGenre = "general"
	GENRE_JPOP     SearchFilterGenre = "jpop"
	GENRE_ANIME    SearchFilterGenre = "anime"
	GENRE_VOCALOID SearchFilterGenre = "vocaloid"
)

type SearchQuery

type SearchQuery struct {
	Sort   SearchSortType
	Order  SearchSortOrder
	Filter SearchFilter
}

func ParseSearchQuery

func ParseSearchQuery(keywords string) SearchQuery

ParseSearchQuery parses the sonolus keywords to query

type SearchSortOrder

type SearchSortOrder int
const (
	ORDER_DESC SearchSortOrder = 0
	ORDER_ASC  SearchSortOrder = 1
)

type SearchSortType

type SearchSortType string
const (
	SORT_UPDATED_DATE SearchSortType = "updatedDate"
	SORT_CREATED_DATE SearchSortType = "createdDate"
	SORT_NAME         SearchSortType = "name"
	SORT_DIFFICULTY   SearchSortType = "rating"
	SORT_NOTES        SearchSortType = "notes"
)

Jump to

Keyboard shortcuts

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