models

package
v0.0.0-...-08daa4e Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HealthCheck

type HealthCheck struct {
	At             time.Time     `json:"at"`
	URL            string        `json:"url"`
	Every          time.Duration `json:"every"`
	DNS            time.Duration `json:"dns"`
	Handshake      time.Duration `json:"handshake"`
	Connect        time.Duration `json:"connect"`
	TotalResponse  time.Duration `json:"total"`
	ServerResponse time.Duration `json:"server"`
	Status         int           `json:"status"`
}

type Service

type Service struct {
	ID          string      `json:"id" storm:"id"`
	Name        string      `json:"name"`
	Description string      `json:"description"`
	HealthCheck HealthCheck `json:"healthcheck"`
	UserID      string      `json:"user_id"`
	Count       int         `json:"count"`
}

func NewService

func NewService(user *User, hurl, name, description string, every time.Duration) (*Service, error)

func (*Service) Fetch

func (s *Service) Fetch() (*TimedResponse, error)

type TimedResponse

type TimedResponse struct {
	ID        xid.ID
	At        time.Time
	Server    time.Duration
	Total     time.Duration
	Status    int
	ServiceID string
}

type TokenPair

type TokenPair struct {
	Access  string `json:"access_token"`
	Refresh string `json:"refresh_token"`
}

func (TokenPair) Marhsal

func (t TokenPair) Marhsal() ([]byte, error)

type User

type User struct {
	ID       string `storm:"id" json:"id"`
	Email    string `storm:"unique" json:"email"`
	Password []byte `json:"password"`

	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	LastLogin time.Time `json:"last_login"`
}

func NewUser

func NewUser(email, password string) (*User, error)

func (User) CheckPassword

func (u User) CheckPassword(raw string) bool

CheckPassword is a simple utility function to check the password given as raw against the user's hashed password

Jump to

Keyboard shortcuts

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