entities

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomTime

type CustomTime struct {
	time.Time
}

CustomTime handles timestamp conversion between Go's time.Time and sqlite's TEXT.

func (*CustomTime) Scan

func (ct *CustomTime) Scan(value interface{}) error

Scan converts a sqlite TEXT timestamp into a CustomTime.

func (CustomTime) Value

func (ct CustomTime) Value() (driver.Value, error)

Value converts a CustomTime into a sqlite TEXT timestamp

type Shortlink struct {
	Slug          string      `json:"slug,omitempty" db:"slug"`                     // added by API
	Kind          string      `json:"kind" db:"kind"`                               // required, 'workflow' or 'url'
	Content       string      `json:"content" db:"content"`                         // required, JSON or URL
	CreatorIP     string      `json:"creator_ip,omitempty" db:"creator_ip"`         // added by API
	CreatedAt     CustomTime  `json:"created_at,omitempty" db:"created_at"`         // added by DB
	ExpiresAt     *CustomTime `json:"expires_at,omitempty" db:"expires_at"`         // optional
	Password      string      `json:"password,omitempty" db:"password"`             // optional
	AllowedVisits int         `json:"allowed_visits,omitempty" db:"allowed_visits"` // optional, -1 for unlimited
}

Shortlink represents a shortlink to a workflow JSON or URL.

type Visit

type Visit struct {
	ID        int        `json:"id" db:"id"`
	Slug      string     `json:"slug" db:"slug"`
	TS        CustomTime `json:"ts" db:"ts"`
	Referer   string     `json:"referer" db:"referer"`
	UserAgent string     `json:"user_agent" db:"user_agent"`
}

Visit represents an access to a shortlink.

Jump to

Keyboard shortcuts

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