db

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePost

func CreatePost(db *gorm.DB, PostID, title, content string, authorID uint) error

func InitDatabase

func InitDatabase(config *config.Config) *gorm.DB

Types

type Post

type Post struct {
	PostID    string `gorm:"primaryKey;not null"`
	Title     string `gorm:"type:text;not null"`
	Content   string `gorm:"type:text;not null"`
	AuthorID  uint   `json:"-"` //Foreign key
	User      User   `gorm:"-" json:"postid,omitempty"`
	CreatedAt time.Time
}

type User

type User struct {
	ID       uint `gorm:"unique;not null" json:"id,omitempty"`
	Username string
	Email    string
	Password string
}

User DAO logic not write yet

Jump to

Keyboard shortcuts

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