utils

package
v0.0.0-...-f2bd8bc Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFaker

func CreateFaker[T any]() (T, error)

func GenerateNewAccessToken

func GenerateNewAccessToken(userId string) (string, error)

func GetValue

func GetValue(key string) string

Types

type BlogFaker

type BlogFaker struct {
	ID        string     `json:"id" bson:"_id,omitempty"`
	Title     string     `json:"title" bson:"title" faker:"name"`
	Content   string     `json:"content" bson:"content" faker:"word"`
	Author    *UserFaker `json:"author" bson:"author"`
	CreatedAt time.Time  `json:"createdAt" bson:"createdAt"`
	UpdatedAt time.Time  `json:"updatedAt" bson:"updatedAt"`
}

type TokenMetadata

type TokenMetadata struct {
	Expires int64
	UserId  string
}

func CheckToken

func CheckToken(r *http.Request) (*TokenMetadata, error)

func ExtractTokenMetadata

func ExtractTokenMetadata(r *http.Request) (*TokenMetadata, error)

type UserFaker

type UserFaker struct {
	ID        string     `json:"id" bson:"_id,omitempty"`
	Username  string     `json:"username" bson:"username" faker:"username"`
	Email     string     `json:"email" bson:"email" faker:"email"`
	Password  string     `json:"password" bson:"password" faker:"password"`
	CreatedAt time.Time  `json:"createdAt" bson:"createdAt"`
	UpdatedAt *time.Time `json:"updatedAt" bson:"updatedAt"`
}

Jump to

Keyboard shortcuts

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