params

package
v0.0.0-...-8bff5d1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	User obj = iota
	Shop
	Product
	Review
	Order
)

Object types

Variables

This section is empty.

Functions

func EncodeCursor

func EncodeCursor(t time.Time, id string) string

EncodeCursor encodes time and id with base64.

func URLID

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

URLID returns the id parsed from the url.

Types

type Cursor

type Cursor struct {
	// Used defines if the client used a cursor or not
	Used      bool
	CreatedAt time.Time
	ID        string
}

Cursor contains the values used for pagination.

func DecodeCursor

func DecodeCursor(encodedCursor string) (Cursor, error)

DecodeCursor decodes de cursor and returns both it and time

type Query

type Query struct {
	Cursor Cursor
	Limit  string
}

Query contains the request parameters provided by the client.

TODO: include order field to let clients change the objects' order (DESC/ASC)

func ParseQuery

func ParseQuery(rawQuery string, obj obj) (Query, error)

ParseQuery returns the url params received after validating them.

Jump to

Keyboard shortcuts

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