feat: project setup
This commit is contained in:
9
models/MODELS.md
Normal file
9
models/MODELS.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# MODELS
|
||||
|
||||
## FILES
|
||||
- **book** `Interfaces for Elements of the Book`
|
||||
- model.go `Structs`
|
||||
- functions.go `Helper Functions`
|
||||
- **citations** `Interfaces for Interacting With Citations`
|
||||
- model.go `Structs`
|
||||
- functions.go `Helper Functions`
|
||||
8
models/book/functions.go
Normal file
8
models/book/functions.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package book
|
||||
|
||||
import "fmt"
|
||||
|
||||
// String helper method to convert dialogue struct into a string
|
||||
func (d *Dialogue) String() string {
|
||||
return fmt.Sprintf("%s", d.Content)
|
||||
}
|
||||
43
models/book/model.go
Normal file
43
models/book/model.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package book
|
||||
|
||||
// Book is a model for storing chapters, author, title, and total pages
|
||||
type Book struct {
|
||||
Title string `json:"title"`
|
||||
Chapters []Chapter `json:"chapters"`
|
||||
TotalPages int `json:"total_pages"`
|
||||
}
|
||||
|
||||
// Chapter is a model that holds chaper number and pages within that chapter
|
||||
type Chapter struct {
|
||||
Index int `json:"index"` // Chapter number
|
||||
Pages []Page `json:"pages"`
|
||||
}
|
||||
|
||||
// Page is model that stores page number and paragraphs
|
||||
type Page struct {
|
||||
Index int `json:"index"`
|
||||
Paragraphs []Paragraph `json:"paragraphs"`
|
||||
}
|
||||
|
||||
// Paragraph is a model that stores paragraph number and lines
|
||||
type Paragraph struct {
|
||||
Index int `json:"index"`
|
||||
Lines []Line `json:"lines"`
|
||||
}
|
||||
|
||||
// Line is an interface for storing the content of a line
|
||||
type Line struct {
|
||||
Index int `json:"index"`
|
||||
Content any `json:"content"`
|
||||
}
|
||||
|
||||
// Dialogue is a model that stores the speaker, and text
|
||||
type Dialogue struct {
|
||||
Speaker *string `json:"speaker,omitempty"`
|
||||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
// Narration is a model that stores text that isnt dialogue
|
||||
type Narration struct {
|
||||
Content string `json:"content"`
|
||||
|
||||
13
models/citations/functions.go
Normal file
13
models/citations/functions.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package citations
|
||||
|
||||
import "fmt"
|
||||
|
||||
// Method to return a MLA citation as a string
|
||||
func (c *MLACitation) String() string {
|
||||
return fmt.Sprintf(`"%s" (%s, %d)`, c.Content, c.LastName, c.PageNumber)
|
||||
}
|
||||
|
||||
// Method to return a APA citation as a string
|
||||
func (c *APACitation) String() string {
|
||||
return fmt.Sprintf(`"%s" (%s, %d, p. %d)`, c.Content, c.LastName, c.Year, c.PageNumber)
|
||||
}
|
||||
17
models/citations/model.go
Normal file
17
models/citations/model.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package citations
|
||||
|
||||
// MLACitation is a model for creating an inline citation in the MLA format: (Doe 23)
|
||||
type MLACitation struct {
|
||||
Content string `json:"content"`
|
||||
LastName string `json:"last_name"`
|
||||
PageNumber int `json:"page_number"`
|
||||
}
|
||||
|
||||
// APACitation is a model for creating an inline citation in the APA format: (Doe, 2020, p. 23)
|
||||
type APACitation struct {
|
||||
Content string `json:"content"`
|
||||
LastName string `json:"last_name"`
|
||||
Year int `json:"year"`
|
||||
PageNumber int `json:"page_number"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user