store

package
v0.0.0-...-9451e73 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePost

func CreatePost(db *sql.DB, post model.Post) (model.Post, error)

CreatePost will insert a Post into the database and return a modified Post (ie with a new ID).

func CreateThread

func CreateThread(db *sql.DB, thread model.Thread) (model.Thread, error)

CreateThread will insert a Thread into the database and return a modified Thread (ie with a new ID).

func CreateTopic

func CreateTopic(db *sql.DB, topic model.Topic) (model.Topic, error)

CreateTopic will insert a Topic into the database and return a modified Topic (ie with a new ID).

func CreateUser

func CreateUser(db *sql.DB, user model.User) (model.User, error)

CreateUser will insert a User into the database and return a modified User (ie with a new ID).

func GetOrCreateUserByName

func GetOrCreateUserByName(db *sql.DB, name string) (model.User, error)

GetOrCreateUserByName will return either an existing user, or a newly created user, with the given name.

func GetThreadByID

func GetThreadByID(db *sql.DB, threadID int64) (model.Thread, error)

GetThreadByID gets one thread or returns sql.ErrNoRows

func GetTopicByID

func GetTopicByID(db *sql.DB, topicID int64) (model.Topic, error)

GetTopicByID gets one topic or returns sql.ErrNoRows

func GetUserByID

func GetUserByID(db *sql.DB, userID int64) (model.User, error)

GetUserByID will query and return a User by ID. If no user matches, sql.ErrNoRows will be returned as the error.

func GetUserByName

func GetUserByName(db *sql.DB, name string) (model.User, error)

GetUserByName will query and return a User by ID. If no user matches, sql.ErrNoRows will be returned as the error.

func NewConnection

func NewConnection(sqliteConnectString string) (*sql.DB, error)

NewConnection returns a new sqlite3 database connection.

func QueryPostsByThreadID

func QueryPostsByThreadID(db *sql.DB, threadID int64) ([]model.Post, error)

QueryPostsByThreadID selects all the posts for a given thread.

func QueryThreadsByTopicID

func QueryThreadsByTopicID(db *sql.DB, topicID int64) ([]model.Thread, error)

QueryThreadsByTopicID returns the list of threads for a topic.

func QueryTopics

func QueryTopics(db *sql.DB) ([]model.Topic, error)

QueryTopics query all the topics and return them.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL