models

package
v0.0.0-...-24e4e94 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	gorm.Model `json:"-"`
	Token      string `gorm:"unique;not null" json:"token"`
	Links      []Link `json:"-"`
}
type Link struct {
	gorm.Model `json:"-"`
	Original   string `gorm:"not null" json:"original""`
	Identifier string `gorm:"unique;not null" json:"-"`
	Shortened  string `gorm:"unique; not null" json:"shortened"`
	AccountID  uint   `json:"-"`
	Views      []View `json:"views"`
}

func (*Link) Shorten

func (link *Link) Shorten(req *http.Request) error

func (*Link) Validate

func (link *Link) Validate() error

type Location

type Location struct {
	IpFrom      int     `json:"-"`
	IpTo        int     `json:"-"`
	CountryCode string  `json:"-"`
	CountryName string  `json:"country"`
	RegionName  string  `json:"-"`
	CityName    string  `json:"city"`
	Latitude    float64 `json:"-"`
	Longitude   float64 `json:"-"`
	ZipCode     string  `json:"-"`
	TimeZone    string  `json:"-"`
}

type View

type View struct {
	ID        uint       `gorm:"primary_key" json:"-"`
	CreatedAt time.Time  `json:"createdAt"`
	UpdatedAt time.Time  `json:"-"`
	DeletedAt *time.Time `sql:"index" json:"-"`
	LinkID    uint       `json:"-"`
	UserAgent string     `json:"userAgent"`
	Referer   string     `json:"referer"`
	Country   string     `json:"country"`
	City      string     `json:"city"`
	ZipCode   string     `json:"zipCode"`
}

Jump to

Keyboard shortcuts

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