models

package
v0.0.0-...-3a39eda Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrShortyNotFound = errors.New("shorty not found")
	ErrShortyExists   = errors.New("shorty already exist")
)

Functions

This section is empty.

Types

type Shorty

type Shorty struct {
	ID        string     `json:"id" db:"id"`
	URL       string     `json:"url" db:"url"`
	Visits    []Visit    `json:"visits" db:"visits"`
	CreatedAt *time.Time `json:"created_at" db:"created_at"`
	UpdatedAt *time.Time `json:"updated_at" db:"updated_at"`
}

func (*Shorty) BeforeCreate

func (s *Shorty) BeforeCreate()

func (*Shorty) BeforeUpdate

func (s *Shorty) BeforeUpdate()

type ShortyInput

type ShortyInput struct {
	ID  string `json:"id"`
	URL string `json:"url"`
}

type Visit

type Visit struct {
	ShortyID  string     `json:"shorty_id" db:"shorty_id"`
	Referer   string     `json:"referer" db:"referer"`
	UserIP    string     `json:"user_ip" db:"user_ip"`
	UserAgent string     `json:"user_agent" db:"user_agent"`
	CreatedAt *time.Time `json:"created_at" db:"created_at"`
	UpdatedAt *time.Time `json:"updated_at" db:"updated_at"`
}

func (*Visit) BeforeCreate

func (v *Visit) BeforeCreate()

type VisitInput

type VisitInput struct {
	ShortyID  string `json:"shorty_id"`
	Referer   string `json:"referer"`
	UserIP    string `json:"user_ip"`
	UserAgent string `json:"user_agent"`
}

Jump to

Keyboard shortcuts

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