models

package
v0.0.0-...-9b663ca Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Note

type Note struct {
	base.Model
	ID        string         `gorm:"column:id;size:36;NOT NULL;PRIMARY_KEY"`
	ParentID  string         `gorm:"column:parent_id;size:36;NOT NULL;index:parent_id"`
	UID       int64          `gorm:"NOT NULL;index:uid"`
	NoteType  int8           `gorm:"NOT NULL"`
	Level     int8           `gorm:"NOT NULL"`
	Title     string         `gorm:"size:50;NOT NULL;"`
	State     int8           `gorm:"NOT NULL"`
	Version   int32          `gorm:"NOT NULL"`
	Color     string         `gorm:"size:7;NOT NULL;default:''"`
	Content   string         `gorm:"NOT NULL"`
	Tags      pq.StringArray `gorm:"type:varchar(10)[]"`
	SHA1      string         `gorm:"column:sha1;size:40;NOT NULL"`
	CreatedAt time.Time
	UpdatedAt time.Time
}

Note ...

func NewNote

func NewNote() *Note

NewNote ..

func NewNoteFromPB

func NewNoteFromPB(in *pb.Note) *Note

NewNoteFromPB ...

func (*Note) ClassifyNotes

func (m *Note) ClassifyNotes(serverNotes []*Note,
	clientNotes []*pb.Note, syncLocal *bool) ([]*Note, []*Note, []*Note, []*Note)

ClassifyNotes classify notes for create,update,delete and client should sync

func (*Note) DeleteAllChildNodes

func (m *Note) DeleteAllChildNodes() (err error)

DeleteAllChildNodes ...

func (*Note) GetLatestNotes

func (m *Note) GetLatestNotes(notes []*Note) []*Note

GetLatestNotes ..

func (*Note) GetNotesForSync

func (m *Note) GetNotesForSync(in *pb.SyncNotesRequest) ([]*Note, error)

GetNotesForSync ...

func (*Note) HasInvalidNotes

func (m *Note) HasInvalidNotes(in *pb.SyncNotesRequest) bool

HasInvalidNotes check if uid inconsistent or level error

func (*Note) List

func (m *Note) List(parentID string, uid int64) (list []*Note, err error)

List list model

func (*Note) ListToMap

func (m *Note) ListToMap(notes []*Note) map[string]*Note

ListToMap list 转map

func (*Note) Sorts

func (m *Note) Sorts(notes []*Note) []*Note

Sorts ..

func (*Note) TableName

func (m *Note) TableName() string

TableName ..

func (*Note) ToNotePB

func (m *Note) ToNotePB() *pb.Note

toNotePB ...

func (*Note) ToNotePBs

func (m *Note) ToNotePBs(data []*Note) []*pb.Note

ToNotePBs ...

func (*Note) UpdateNotes

func (m *Note) UpdateNotes(notes []*Note) error

UpdateNotes ...

type NoteHistory

type NoteHistory struct {
	base.Model
	ID        int64     `gorm:"column:id;size:36;NOT NULL;PRIMARY_KEY"`
	NoteID    string    `gorm:"column:note_id;size:36;NOT NULL;index:note_id"`
	UID       int64     `gorm:"NOT NULL;index:note_uid"`
	Title     string    `gorm:"size:50;NOT NULL"`
	Content   string    `gorm:"NOT NULL"`
	Version   int32     `gorm:"NOT NULL"`
	SHA1      string    `gorm:"column:sha1;size:40;NOT NULL"`
	CreatedAt time.Time `gorm:"NOT NULL"`
}

NoteHistory ...

func NewNoteHistory

func NewNoteHistory(in *Note) *NoteHistory

NewNoteHistory ...

Jump to

Keyboard shortcuts

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