db

package
v0.0.0-...-e2c2aad Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Functions

func CreateNote

func CreateNote(ctx context.Context, notes []*Note) error

CreateNote create note info

func DeleteNote

func DeleteNote(ctx context.Context, noteID, userID int64) error

DeleteNote delete note info

func Init

func Init()

Init init DB

func UpdateNote

func UpdateNote(ctx context.Context, noteID, userID int64, title, content *string) error

UpdateNote update note info

Types

type Note

type Note struct {
	gorm.Model
	UserID  int64  `json:"user_id"`
	Title   string `json:"title"`
	Content string `json:"content"`
}

func MGetNotes

func MGetNotes(ctx context.Context, noteIDs []int64) ([]*Note, error)

MGetNotes multiple get list of note info

func QueryNote

func QueryNote(ctx context.Context, userID int64, searchKey *string, limit, offset int) ([]*Note, int64, error)

QueryNote query list of note info

func (*Note) TableName

func (n *Note) TableName() string

Jump to

Keyboard shortcuts

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