db

package
v0.0.0-...-f7315f1 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenDB

func OpenDB(dataSourceName string) (*gorm.DB, error)

OpenDB ...

Types

type Comment

type Comment struct {
	// contains filtered or unexported fields
}

Comment ...

func NewComment

func NewComment(pool *gorm.DB) Comment

NewComment ...

func (Comment) Create

func (db Comment) Create(postID uint, comment models.Comment) (
	id int,
	err error,
)

Create ...

func (Comment) GetAll

func (db Comment) GetAll(postID int) ([]models.Comment, error)

GetAll ...

type Post

type Post struct {
	// contains filtered or unexported fields
}

Post ...

func NewPost

func NewPost(pool *gorm.DB) Post

NewPost ...

func (Post) Create

func (db Post) Create(post models.Post) (id int, err error)

Create ...

func (Post) Delete

func (db Post) Delete(id int) error

Delete ...

func (Post) GetAll

func (db Post) GetAll(pagination models.Pagination) ([]models.Post, error)

GetAll ...

func (Post) GetSingle

func (db Post) GetSingle(id int) (models.Post, error)

GetSingle ...

func (Post) Update

func (db Post) Update(id int, post models.Post) error

Update ...

Jump to

Keyboard shortcuts

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