db

package
v0.0.0-...-e7752b8 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommentRow

type CommentRow struct {
	ID     string
	Slug   sql.NullString
	Body   sql.NullString
	Author sql.NullString
}

type Database

type Database struct {
	Client *sqlx.DB
}

func NewDatabase

func NewDatabase() (*Database, error)

NewDatabase - returns a pointer to a database object

func (*Database) CreateComment

func (*Database) CreateComment(ctx context.Context, cmt comment.Comment) (comment.Comment, error)

CreateComment implements comment.Store

func (*Database) DeleteComment

func (*Database) DeleteComment(ctx context.Context, id string) error

DeleteComment implements comment.Store

func (*Database) DeleteCommentById

func (d *Database) DeleteCommentById(ctx context.Context, id string) error

func (*Database) GetComment

func (d *Database) GetComment(ctx context.Context, uuid string) (comment.Comment, error)

func (*Database) MigrateDB

func (d *Database) MigrateDB() error

MigrateDB - migrates our database and creates our comment table

func (*Database) Ping

func (d *Database) Ping(ctx context.Context) error

func (*Database) PostComment

func (d *Database) PostComment(ctx context.Context, cmt comment.Comment) (comment.Comment, error)

func (*Database) UpdateComment

func (*Database) UpdateComment(ctx context.Context, id string, cmt comment.Comment) (comment.Comment, error)

UpdateComment implements comment.Store

func (*Database) UpdateCommentById

func (d *Database) UpdateCommentById(ctx context.Context, uuid string, cmt comment.Comment) (comment.Comment, error)

Jump to

Keyboard shortcuts

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