ref(models): change property accessability

This commit is contained in:
Kristian Borgwarth 2026-03-24 22:10:00 +01:00
parent fcb09e717d
commit ec8de90d23
4 changed files with 98 additions and 14 deletions

View file

@ -1,7 +1,27 @@
package models package models
type Link struct { type Link struct {
FromNoteID int fromNoteID int
ToNoteID int toNoteID int
Raw string 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
} }

View file

@ -1,11 +1,45 @@
package models package models
type Note struct { type Note struct {
ID int id int
Path string path string
Title string title string
Slug string slug string
CreatedAt string createdAt string
UpdatedAt 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
} }

View file

@ -1,6 +1,21 @@
package models package models
type NoteTag struct { type NoteTag struct {
NoteID int noteID int
TagID 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
} }

View file

@ -1,6 +1,21 @@
package models package models
type Tag struct { type Tag struct {
ID int id int
Name string 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
} }