Documentation
¶
Index ¶
- type Config
- type MySQL
- func (m *MySQL) Close()
- func (m *MySQL) CreateShortLink(sl *shortlink.ShortLink) (*shortlink.ShortLink, error)
- func (m *MySQL) DeleteShortLink(id int) error
- func (m *MySQL) GetShortLink(id, root, short string) (*shortlink.ShortLink, error)
- func (m *MySQL) GetShortLinkCount() (int, error)
- func (m *MySQL) GetShortLinks(from, limit int) ([]*shortlink.ShortLink, error)
- func (m *MySQL) Open(cfg interface{}) error
- func (m *MySQL) UpdateShortLink(id int, updated *shortlink.ShortLink) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Host string `json:"host"` Username string `json:"username"` Password string `json:"password"` Database string `json:"database"` }
Config contains the configuration for a MySQL database connection.
type MySQL ¶
type MySQL struct {
// contains filtered or unexported fields
}
MySQL maintains the connection to a MySQL database.
func (*MySQL) CreateShortLink ¶
func (*MySQL) DeleteShortLink ¶
func (*MySQL) GetShortLink ¶
GetShortLink gets a short link object from database by id, root link or short link, depending on which was passed first (in this order). If no short link was found, no error will be returned and the returned short link object will be nil.
func (*MySQL) GetShortLinkCount ¶
GetShortLinkCount returns the number of short link entries in the database.
func (*MySQL) GetShortLinks ¶
Click to show internal directories.
Click to hide internal directories.