models

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Functions

func Init

func Init() (err error)

Init initializes the database.

Types

type Comment

type Comment struct {
	ID        int    `json:"id"`
	ParentID  int    `json:"parentID"`
	ArticleID string `json:"articleID"`
	Avatar    string `json:"avatar"`
	Name      string `json:"name"`
	Email     string `json:"email"`
	Content   string `json:"content"`
	Date      string `json:"date"`
}

func (Comment) Create

func (comment Comment) Create() error

Create inserts a comment into the database.

type Comments

type Comments []Comment

func (Comments) Get

func (comments Comments) Get(articleID string, query api.GetCommentsQuery) (Comments, error)

Get reads comments from the database and returns them.

Jump to

Keyboard shortcuts

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