utils

package
v0.0.0-...-34df7b1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateJWT

func CreateJWT(username string) (string, error)

func HashPassword

func HashPassword(password string) (string, error)

func MatchPasswords

func MatchPasswords(toCheck string, hashed string) bool

func RanHash

func RanHash() string

func ValidateJWT

func ValidateJWT(tokenString string) (*jwt.Token, error)

Types

type CreateDocumentRequest

type CreateDocumentRequest struct {
	Hash    string
	Author  string
	Title   string
	Content string
}

type CreateUserRequest

type CreateUserRequest struct {
	Username string
	Password string
}

type Document

type Document struct {
	Hash      string `json:"hash"`
	Author    string `json:"author"`
	Title     string `json:"title"`
	Content   string `json:"content"`
	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`
}

type Env

type Env struct {
	User          string
	Password      string
	DB            string
	PORT          string
	URL           string
	JwtSecret     string
	RedisURL      string
	RedisPort     string
	RedisDB       string
	RedisPassword string
}

func GetEnv

func GetEnv() *Env

type UpdateDocumentRequest

type UpdateDocumentRequest struct {
	Hash    string
	Title   string
	Content string
}

type User

type User struct {
	Username  string `json:"username"`
	Password  string `json:"password"`
	CreatedAt string `json:"created_at"`
}

Introducing the JSON tag for caching

Jump to

Keyboard shortcuts

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