Documentation
¶
Index ¶
- func CreatePost(db *sql.DB, post model.Post) (model.Post, error)
- func CreateThread(db *sql.DB, thread model.Thread) (model.Thread, error)
- func CreateTopic(db *sql.DB, topic model.Topic) (model.Topic, error)
- func CreateUser(db *sql.DB, user model.User) (model.User, error)
- func GetOrCreateUserByName(db *sql.DB, name string) (model.User, error)
- func GetThreadByID(db *sql.DB, threadID int64) (model.Thread, error)
- func GetTopicByID(db *sql.DB, topicID int64) (model.Topic, error)
- func GetUserByID(db *sql.DB, userID int64) (model.User, error)
- func GetUserByName(db *sql.DB, name string) (model.User, error)
- func NewConnection(sqliteConnectString string) (*sql.DB, error)
- func QueryPostsByThreadID(db *sql.DB, threadID int64) ([]model.Post, error)
- func QueryThreadsByTopicID(db *sql.DB, topicID int64) ([]model.Thread, error)
- func QueryTopics(db *sql.DB) ([]model.Topic, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreatePost ¶
CreatePost will insert a Post into the database and return a modified Post (ie with a new ID).
func CreateThread ¶
CreateThread will insert a Thread into the database and return a modified Thread (ie with a new ID).
func CreateTopic ¶
CreateTopic will insert a Topic into the database and return a modified Topic (ie with a new ID).
func CreateUser ¶
CreateUser will insert a User into the database and return a modified User (ie with a new ID).
func GetOrCreateUserByName ¶
GetOrCreateUserByName will return either an existing user, or a newly created user, with the given name.
func GetThreadByID ¶
GetThreadByID gets one thread or returns sql.ErrNoRows
func GetTopicByID ¶
GetTopicByID gets one topic or returns sql.ErrNoRows
func GetUserByID ¶
GetUserByID will query and return a User by ID. If no user matches, sql.ErrNoRows will be returned as the error.
func GetUserByName ¶
GetUserByName will query and return a User by ID. If no user matches, sql.ErrNoRows will be returned as the error.
func NewConnection ¶
NewConnection returns a new sqlite3 database connection.
func QueryPostsByThreadID ¶
QueryPostsByThreadID selects all the posts for a given thread.
func QueryThreadsByTopicID ¶
QueryThreadsByTopicID returns the list of threads for a topic.
Types ¶
This section is empty.