ref(models): change property accessability
This commit is contained in:
parent
fcb09e717d
commit
ec8de90d23
4 changed files with 98 additions and 14 deletions
|
|
@ -1,7 +1,27 @@
|
|||
package models
|
||||
|
||||
type Link struct {
|
||||
FromNoteID int
|
||||
ToNoteID int
|
||||
Raw string
|
||||
fromNoteID int
|
||||
toNoteID int
|
||||
raw string
|
||||
}
|
||||
|
||||
func NewLink(fromNoteID, toNoteID int, raw string) *Link {
|
||||
return &Link{
|
||||
fromNoteID: fromNoteID,
|
||||
toNoteID: toNoteID,
|
||||
raw: raw,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *Link) FromNoteID() int {
|
||||
return l.fromNoteID
|
||||
}
|
||||
|
||||
func (l *Link) ToNoteID() int {
|
||||
return l.toNoteID
|
||||
}
|
||||
|
||||
func (l *Link) Raw() string {
|
||||
return l.raw
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,45 @@
|
|||
|
||||
package models
|
||||
|
||||
type Note struct {
|
||||
ID int
|
||||
Path string
|
||||
Title string
|
||||
Slug string
|
||||
CreatedAt string
|
||||
UpdatedAt string
|
||||
id int
|
||||
path string
|
||||
title string
|
||||
slug string
|
||||
createdAt string
|
||||
updatedAt string
|
||||
}
|
||||
|
||||
func NewNote(id int, path, title, slug, createdAt, updatedAt string) *Note {
|
||||
return &Note{
|
||||
id: id,
|
||||
path: path,
|
||||
title: title,
|
||||
slug: slug,
|
||||
createdAt: createdAt,
|
||||
updatedAt: updatedAt,
|
||||
}
|
||||
}
|
||||
|
||||
func (n *Note) ID() int {
|
||||
return n.id
|
||||
}
|
||||
|
||||
func (n *Note) Path() string {
|
||||
return n.path
|
||||
}
|
||||
|
||||
func (n *Note) Title() string {
|
||||
return n.title
|
||||
}
|
||||
|
||||
func (n *Note) Slug() string {
|
||||
return n.slug
|
||||
}
|
||||
|
||||
func (n *Note) CreatedAt() string {
|
||||
return n.createdAt
|
||||
}
|
||||
|
||||
func (n *Note) UpdatedAt() string {
|
||||
return n.updatedAt
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,21 @@
|
|||
package models
|
||||
|
||||
type NoteTag struct {
|
||||
NoteID int
|
||||
TagID int
|
||||
noteID int
|
||||
tagID int
|
||||
}
|
||||
|
||||
func NewNoteTag(noteID, tagID int) *NoteTag {
|
||||
return &NoteTag{
|
||||
noteID: noteID,
|
||||
tagID: tagID,
|
||||
}
|
||||
}
|
||||
|
||||
func (nt *NoteTag) NoteID() int {
|
||||
return nt.noteID
|
||||
}
|
||||
|
||||
func (nt *NoteTag) TagID() int {
|
||||
return nt.tagID
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,21 @@
|
|||
package models
|
||||
|
||||
type Tag struct {
|
||||
ID int
|
||||
Name string
|
||||
id int
|
||||
name string
|
||||
}
|
||||
|
||||
func NewTag(id int, name string) *Tag {
|
||||
return &Tag{
|
||||
id: id,
|
||||
name: name,
|
||||
}
|
||||
}
|
||||
|
||||
func (t *Tag) ID() int {
|
||||
return t.id
|
||||
}
|
||||
|
||||
func (t *Tag) Name() string {
|
||||
return t.name
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue