Documentation ¶
Index ¶
- type Database
- type SQLite
- func (s *SQLite) AddSession(sess *Session) error
- func (s *SQLite) AddURL(url *URL) error
- func (s *SQLite) AddURLData(urlData *URLData) error
- func (s *SQLite) AddUser(user *User) error
- func (s *SQLite) DecrementUserURLsCount(user *User) error
- func (s *SQLite) GetAllURLs() ([]*URL, error)
- func (s *SQLite) GetSession(sess *Session) (*Session, error)
- func (s *SQLite) GetSessions() ([]*Session, error)
- func (s *SQLite) GetURL(shortURL string) (*URL, error)
- func (s *SQLite) GetURLData(url *URL) ([]*URLData, error)
- func (s *SQLite) GetURLs(user *User) ([]*URL, error)
- func (s *SQLite) GetUser(user *User) (*User, error)
- func (s *SQLite) GetUsers() ([]*User, error)
- func (s *SQLite) IncrementURLVisits(shortUrl string) error
- func (s *SQLite) IncrementUserURLsCount(user *User) error
- func (s *SQLite) RemoveSession(sess *Session) error
- func (s *SQLite) RemoveURL(url *URL) error
- func (s *SQLite) RemoveURLData(url *URL) error
- func (s *SQLite) RemoveUser(user *User) error
- type Session
- type URL
- type URLData
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database interface { AddURL(*URL) error RemoveURL(*URL) error IncrementURLVisits(shortURL string) error GetURL(shortURL string) (*URL, error) GetURLs(*User) ([]*URL, error) AddUser(*User) error RemoveUser(*User) error IncrementUserURLsCount(*User) error DecrementUserURLsCount(*User) error GetUser(*User) (*User, error) AddURLData(*URLData) error RemoveURLData(*URL) error GetURLData(*URL) ([]*URLData, error) AddSession(*Session) error RemoveSession(*Session) error GetSession(*Session) (*Session, error) GetUsers() ([]*User, error) GetAllURLs() ([]*URL, error) GetSessions() ([]*Session, error) }
Database represents a database that can be used for the program
type SQLite ¶
type SQLite struct {
// contains filtered or unexported fields
}
SQLite represents a sqlite database for the program
func (*SQLite) AddSession ¶
AddSession adds a new session to the database
func (*SQLite) AddURLData ¶
AddURLData adds data of a certain url, and returns an occurred error
func (*SQLite) DecrementUserURLsCount ¶
DecrementUserURLsCount well its written on the box :)
func (*SQLite) GetAllURLs ¶
GetAllURLs returns a slice of available URLs to be seen by the admin only :)
func (*SQLite) GetSession ¶
GetSession returns a specific session from the database
func (*SQLite) GetSessions ¶
GetSession returns a slice of available sessions to be seen by the admin only :)
func (*SQLite) GetURLData ¶
GetURLData returns a slice of URLData of the given URL and an occurred error
func (*SQLite) GetUsers ¶
GetUsers returns a slice of available users to be seen by the admin only :)
func (*SQLite) IncrementURLVisits ¶
IncrementURLVisits well its written in the box :)
func (*SQLite) IncrementUserURLsCount ¶
IncrementUserURLsCount well its written on the box :)
func (*SQLite) RemoveSession ¶
RemoveSession a specific session from the database
func (*SQLite) RemoveURLData ¶
RemoveURLData removes all the data of a given URL, and returns an occurred error
func (*SQLite) RemoveUser ¶
RemoveUser removes the given user from the database
type URL ¶
type URL struct { Short string FullURL string Created string Visits int UserEmail string Alter bool VisitIP string }
URL defines the properties of a certain URL