Documentation ¶
Index ¶
- Constants
- Variables
- type BaseEntity
- type Email
- type Keyword
- type Password
- type Token
- type URL
- func (url URL) GetCustomAlias() string
- func (url URL) GetExpiresOn() time.Time
- func (url URL) GetExpiryDuration() time.Duration
- func (url URL) GetKeywords() []Keyword
- func (url URL) IsActive() bool
- func (url URL) Prefix() string
- func (url URL) SetCustomAlias(customAlias string) error
- func (url URL) SetExpiresOn(expiresOn time.Time)
- func (url URL) SetKeywords(keywords []string) error
- func (url URL) UpdateExpiresOn(expiresOn time.Time) error
- type User
Constants ¶
View Source
const ( // USER_STATUS_ACTIVE UserStatusActive is the status for an active user USER_STATUS_ACTIVE = "ACTIVE" USER_STATUS_DEACTIVATED = "DEACTIVATED" )
Variables ¶
View Source
var ( IP = `` /* 659-byte string literal not displayed */ Schema = `((ftp|https?):\/\/)` Username = `(\S+(:\S*)?@)` Path = `((\/|\?|#)[^\s]*)` Port = `(:(\d{1,5}))` UrlIP = `([1-9]\d?|1\d\d|2[01]\d|22[0-3]|24\d|25[0-5])(\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])){2}(?:\.([0-9]\d?|1\d\d|2[0-4]\d|25[0-5]))` Subdomain = `((www\.)|([a-zA-Z0-9]+([-_\.]?[a-zA-Z0-9])*[a-zA-Z0-9]\.[a-zA-Z0-9]+))` MinLength = 15 MaxLength = 2048 Regex = `^` + Schema + `?` + Username + `?` + `((` + IP + `|(\[` + IP + `\])|(([a-zA-Z0-9]([a-zA-Z0-9-_]+)?[a-zA-Z0-9]([-\.][a-zA-Z0-9]+)*)|(` + Subdomain + `?))?(([a-zA-Z\x{00a1}-\x{ffff}0-9]+-?-?)*[a-zA-Z\x{00a1}-\x{ffff}0-9]+)(?:\.([a-zA-Z\x{00a1}-\x{ffff}]{1,}))?))\.?` + Port + `?` + Path + `?$` FilterRegex = `(xxx|localhost|127\.0\.0\.1|\.lvh\.me|\.local|urlss?h\.)` )
@see https://github.com/asaskevich/govalidator/blob/master/patterns.go
View Source
var (
KeywordRegex = `^[a-zA-Z0-9-_]+$`
)
Functions ¶
This section is empty.
Types ¶
type BaseEntity ¶
type BaseEntity struct { // CreatedAt is the date when the entity was created CreatedAt time.Time // UpdatedAt is the date when the entity was updated UpdatedAt time.Time }
BaseEntity is a base model for all models
type Keyword ¶
type Keyword struct { identifier.ID Value string }
Keyword is model for keywords attached to a url
type Password ¶
type Password struct {
Value string
}
Password contains user password information
func NewPassword ¶
NewPassword creates a new password
type Token ¶
type Token struct { APIKey identifier.ID ResetPasswordExpires *time.Time ResetPasswordToken *identifier.ID VerificationExpires time.Time VerificationToken identifier.ID }
Token contains token information for a user
type URL ¶
type URL struct { // ID is the unique identifier for the url identifier.ID // UserID is the user id of the url owner UserId identifier.ID // ShortCode is the short code for the url ShortCode string // CustomAlias is the custom alias for the url CustomAlias string // OriginalURL is the original url OriginalUrl string // Hits is the number of hits for the url Hits uint // ExpiresOn is the expiration date for the url ExpiresOn time.Time // Keywords is a list of keywords for the url Keywords []Keyword // BaseEntity is the base entity for the url BaseEntity }
URL represents an entity for a url
func NewUrl ¶
func NewUrl(userId identifier.ID, originalUrl string, customAlias string, expiresOn time.Time, keywords []string) (*URL, error)
NewUrl creates a new URL entity
func (URL) GetCustomAlias ¶ added in v1.3.0
func (URL) GetExpiresOn ¶ added in v1.3.0
func (URL) GetExpiryDuration ¶ added in v1.3.0
GetExpiryDuration returns as a time.Duration how long before the url expires This returns an absolute value after subtracting time.Now()
func (URL) GetKeywords ¶ added in v1.3.0
func (URL) SetCustomAlias ¶ added in v1.3.0
func (URL) SetExpiresOn ¶ added in v1.3.0
func (URL) SetKeywords ¶ added in v1.3.0
type User ¶
type User struct { // ID is the unique identifier for a user identifier.ID // BaseEntity is the base entity for a user BaseEntity // Email is the email address for a user Email // Password is the password for a user Password // Token is the token for a user Token // Verified is the verification status for a user Verified bool // Status is the status for a user Status string }
User is a domain entity for user
Click to show internal directories.
Click to hide internal directories.