Documentation ¶
Index ¶
- func CreateImage(image models.Image) error
- func CreatePost(db *sql.DB, tag, title, contentMD, contentHTML string, ...) (*models.Post, error)
- func CreateUser(db *sql.DB, ...) (*models.User, error)
- func DeletePost(db *sql.DB, id uuid.UUID) error
- func GetAllFavoritePosts(db *sql.DB) (*[]models.PostLite, error)
- func GetAllImages() (*[]models.Image, error)
- func GetAllPosts(db *sql.DB) (*[]models.PostLite, error)
- func GetAllUsers(db *sql.DB) (*[]models.User, error)
- func GetImageById(id string) (*models.Image, error)
- func GetImagesBetweenDates(begin time.Time, end time.Time) (*[]models.Image, error)
- func GetPostById(db *sql.DB, id uuid.UUID) (*models.Post, error)
- func GetPostByTag(db *sql.DB, tag string) (*models.Post, error)
- func GetUserById(db *sql.DB, id uuid.UUID) (*models.User, error)
- func GetUserByPersonalLogin(db *sql.DB, login string) (*models.User, error)
- func GetUserCount(db *sql.DB) (int, error)
- func Initialize(db *sql.DB) error
- func UpdatePost(db *sql.DB, id uuid.UUID, tag, title, contentMD, contentHTML string, ...) (*models.Post, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateImage ¶
func CreatePost ¶
func CreatePost(db *sql.DB, tag, title, contentMD, contentHTML string, published, edited *time.Time, isFavorite bool, author uuid.UUID) (*models.Post, error)
CreatePost will add a post to the supplied database with the content specified in the method call. Fields given `nil` values will be marked as `NULL` in the database.
func CreateUser ¶
func CreateUser(db *sql.DB, firstName, lastName, email, location, catchPhrase, login, hashedPw string) (*models.User, error)
CreateUser creates a User object in the supplied database with the given information.
func GetAllFavoritePosts ¶
GetAllFavoritePosts does the same thing as GetAllPosts, but only returns the posts marked as IsFavorite in the database.
func GetAllImages ¶
func GetAllPosts ¶
GetAllPosts will contact the database that is passed into it and query for all posts. It will then return a slice of PostLite objects, containing only minimal identifying information about the posts, meant to be used for displaying many post titles in a list.
func GetAllUsers ¶
GetAllUsers returns a slice containing the User models of all users in the supplied database. The Login and Hashed Password fields are ignored.
func GetImagesBetweenDates ¶
func GetPostById ¶
GetPostById returns a post from the supplied database based on the given UUID.
func GetPostByTag ¶
GetPostByTag returns a post from the supplied database based on the given tag.
func GetUserById ¶
GetUserById returns a User model containing information about the given user in the supplied database. The Login and Hashed Password fields are ignored.
func GetUserByPersonalLogin ¶
GetUserByPersonalLogin returns a User model containing all information for the user in the supplied database. This includes the user's Login and Hashed Password. This method is meant to be used to retrieve information for a user attempting to authenticate with the system.
func GetUserCount ¶
GetUserCount returns the number of admin users which exist in the supplied database.
func Initialize ¶
Initialize runs initialization scripts to create the tables necessary for the blog functionality. These scripts are non-destructive if data already exists.
func UpdatePost ¶
func UpdatePost(db *sql.DB, id uuid.UUID, tag, title, contentMD, contentHTML string, published, edited *time.Time, isFavorite bool, author uuid.UUID) (*models.Post, error)
UpdatePost will update a post in the supplied database, identified by the specified UUID. It will fully replace all contents of the post, except for the id field, which will always be ignored.
Types ¶
This section is empty.