Documentation
¶
Index ¶
- func AddUrl(data map[string]interface{}) error
- func AddUser(username, password string) error
- func CheckAuth(username, password string) (bool, error)
- func DeleteUrl(shortern string) error
- func EditUser(id int, password string) error
- func ExistAuthByUsername(username string) (bool, error)
- func ExistUrlByOrigin(origin string) (bool, error)
- func ExistUrlByShortern(shorten string) (bool, error)
- func Setup()
- type Auth
- type Model
- type Url
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExistAuthByUsername ¶
ExistAuthByUsername check if a user exists based on username
func ExistUrlByOrigin ¶
ExistUrlByOrigin checks if a url exists based on origin url
func ExistUrlByShortern ¶
Types ¶
type Auth ¶
type Auth struct { ID int `gorm:"primaryKey" json:"id"` Username string `json:"username"` Password string `json:"password"` }
func GetUserByUsername ¶
GetUserByUsername get user infomathion by username
type Url ¶
type Url struct { ID int `gorm:"primaryKey" json:"id"` OriginUrl string `json:"origin_url" gorm:"index"` ShorternUrl string `json:"shortern_url"` CreatedBy int `json:"created_by"` Model }
func GetShortByOrigin ¶
GetShortByOrigin get a shortern url on origin_url
func GetUrlByShort ¶
GetUrl get a url based on short_url
Click to show internal directories.
Click to hide internal directories.