models

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 5, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseDB

func CloseDB()

Close the database

func CreateDB

func CreateDB()

Create the database

func CreatePost

func CreatePost(text string) (int64, error)

Create a new Post in the database

func DeletePostByID

func DeletePostByID(id int) error

Delete a Post from the database

func OpenDB

func OpenDB()

Open the database

func UpdatePostByID

func UpdatePostByID(id int, text string) error

Update a Post in the database

Types

type Post

type Post struct {
	ID   int
	Text string
}

The Post struct

func GetAllPosts

func GetAllPosts() ([]*Post, error)

Get all Posts from the database

func GetPostByID

func GetPostByID(id int) (*Post, error)

Get a Post from the database

Jump to

Keyboard shortcuts

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