Skip to content

threefold.models_to_move.library #

fn Book.new #

fn Book.new() Book

new creates a new Book with default values

fn Collection.new #

fn Collection.new() Collection

new creates a new Collection with default values

fn Image.new #

fn Image.new() Image

new creates a new Image with default values

fn Markdown.new #

fn Markdown.new() Markdown

new creates a new Markdown document with default values

fn Pdf.new #

fn Pdf.new() Pdf

new creates a new Pdf with default values

fn Slide.new #

fn Slide.new() Slide

new creates a new Slide

fn Slideshow.new #

fn Slideshow.new() Slideshow

new creates a new Slideshow with default values

fn TocEntry.new #

fn TocEntry.new() TocEntry

new creates a new TocEntry with default values

struct Book #

@[heap]
struct Book {
pub mut:
	id                u32        // Unique book ID
	title             string     // Title of the book
	description       ?string    // Optional description of the book
	table_of_contents []TocEntry // Table of contents
	pages             []string   // Pages content (markdown strings)
	created_at        u64        // Creation timestamp
	updated_at        u64        // Last update timestamp
}

Book represents a Book library item (collection of markdown pages with TOC)

fn (Book) title #

fn (mut b Book) title(title string) Book

title sets the title of the book (builder pattern)

fn (Book) description #

fn (mut b Book) description(description string) Book

description sets the description of the book (builder pattern)

fn (Book) add_page #

fn (mut b Book) add_page(content string) Book

add_page adds a page to the book (builder pattern)

fn (Book) add_toc_entry #

fn (mut b Book) add_toc_entry(entry TocEntry) Book

add_toc_entry adds a TOC entry to the book (builder pattern)

fn (Book) table_of_contents #

fn (mut b Book) table_of_contents(toc []TocEntry) Book

table_of_contents sets the table of contents (builder pattern)

fn (Book) pages #

fn (mut b Book) pages(pages []string) Book

pages sets all pages at once (builder pattern)

fn (Book) page_count #

fn (b Book) page_count() u32

page_count returns the number of pages in the book

fn (Book) get_page #

fn (b Book) get_page(index u32) ?string

get_page gets a page by index (0-based)

fn (Book) has_toc #

fn (b Book) has_toc() bool

has_toc checks if the book has a table of contents

fn (Book) is_empty #

fn (b Book) is_empty() bool

is_empty checks if the book has no pages

struct Collection #

@[heap]
struct Collection {
pub mut:
	id          u32     // Unique collection ID
	title       string  // Title of the collection
	description ?string // Optional description of the collection
	images      []u32   // List of image item IDs belonging to this collection
	pdfs        []u32   // List of PDF item IDs belonging to this collection
	markdowns   []u32   // List of Markdown item IDs belonging to this collection
	books       []u32   // List of Book item IDs belonging to this collection
	slides      []u32   // List of Slides item IDs belonging to this collection
	created_at  u64     // Creation timestamp
	updated_at  u64     // Last update timestamp
}

Collection represents a collection of library items

fn (Collection) title #

fn (mut c Collection) title(title string) Collection

title sets the title of the collection (builder pattern)

fn (Collection) description #

fn (mut c Collection) description(description string) Collection

description sets the description of the collection (builder pattern)

fn (Collection) add_image #

fn (mut c Collection) add_image(image_id u32) Collection

add_image adds an image ID to the collection (builder pattern)

fn (Collection) add_pdf #

fn (mut c Collection) add_pdf(pdf_id u32) Collection

add_pdf adds a PDF ID to the collection (builder pattern)

fn (Collection) add_markdown #

fn (mut c Collection) add_markdown(markdown_id u32) Collection

add_markdown adds a markdown ID to the collection (builder pattern)

fn (Collection) add_book #

fn (mut c Collection) add_book(book_id u32) Collection

add_book adds a book ID to the collection (builder pattern)

fn (Collection) add_slides #

fn (mut c Collection) add_slides(slides_id u32) Collection

add_slides adds a slides ID to the collection (builder pattern)

fn (Collection) total_items #

fn (c Collection) total_items() u32

total_items returns the total number of items in the collection

fn (Collection) has_images #

fn (c Collection) has_images() bool

has_images checks if the collection has any images

fn (Collection) has_pdfs #

fn (c Collection) has_pdfs() bool

has_pdfs checks if the collection has any PDFs

fn (Collection) has_markdowns #

fn (c Collection) has_markdowns() bool

has_markdowns checks if the collection has any markdown documents

fn (Collection) has_books #

fn (c Collection) has_books() bool

has_books checks if the collection has any books

fn (Collection) has_slides #

fn (c Collection) has_slides() bool

has_slides checks if the collection has any slideshows

fn (Collection) is_empty #

fn (c Collection) is_empty() bool

is_empty checks if the collection is empty

fn (Collection) remove_image #

fn (mut c Collection) remove_image(image_id u32)

remove_image removes an image ID from the collection

fn (Collection) remove_pdf #

fn (mut c Collection) remove_pdf(pdf_id u32)

remove_pdf removes a PDF ID from the collection

fn (Collection) remove_markdown #

fn (mut c Collection) remove_markdown(markdown_id u32)

remove_markdown removes a markdown ID from the collection

fn (Collection) remove_book #

fn (mut c Collection) remove_book(book_id u32)

remove_book removes a book ID from the collection

fn (Collection) remove_slides #

fn (mut c Collection) remove_slides(slides_id u32)

remove_slides removes a slides ID from the collection

fn (Collection) contains_image #

fn (c Collection) contains_image(image_id u32) bool

contains_image checks if the collection contains a specific image

fn (Collection) contains_pdf #

fn (c Collection) contains_pdf(pdf_id u32) bool

contains_pdf checks if the collection contains a specific PDF

fn (Collection) contains_markdown #

fn (c Collection) contains_markdown(markdown_id u32) bool

contains_markdown checks if the collection contains a specific markdown

fn (Collection) contains_book #

fn (c Collection) contains_book(book_id u32) bool

contains_book checks if the collection contains a specific book

fn (Collection) contains_slides #

fn (c Collection) contains_slides(slides_id u32) bool

contains_slides checks if the collection contains a specific slideshow

fn (Collection) get_description_string #

fn (c Collection) get_description_string() string

get_description_string returns the description as a string (empty if none)

struct Image #

@[heap]
struct Image {
pub mut:
	id          u32     // Unique image ID
	title       string  // Title of the image
	description ?string // Optional description of the image
	url         string  // URL of the image
	width       u32     // Width of the image in pixels
	height      u32     // Height of the image in pixels
	created_at  u64     // Creation timestamp
	updated_at  u64     // Last update timestamp
}

Image represents an Image library item

fn (Image) title #

fn (mut i Image) title(title string) Image

title sets the title of the image (builder pattern)

fn (Image) description #

fn (mut i Image) description(description string) Image

description sets the description of the image (builder pattern)

fn (Image) url #

fn (mut i Image) url(url string) Image

url sets the URL of the image (builder pattern)

fn (Image) width #

fn (mut i Image) width(width u32) Image

width sets the width of the image (builder pattern)

fn (Image) height #

fn (mut i Image) height(height u32) Image

height sets the height of the image (builder pattern)

fn (Image) aspect_ratio #

fn (i Image) aspect_ratio() f64

aspect_ratio calculates the aspect ratio of the image

fn (Image) is_landscape #

fn (i Image) is_landscape() bool

is_landscape checks if the image is in landscape orientation

fn (Image) is_portrait #

fn (i Image) is_portrait() bool

is_portrait checks if the image is in portrait orientation

fn (Image) is_square #

fn (i Image) is_square() bool

is_square checks if the image is square

struct Markdown #

@[heap]
struct Markdown {
pub mut:
	id          u32     // Unique markdown ID
	title       string  // Title of the document
	description ?string // Optional description of the document
	content     string  // The markdown content
	created_at  u64     // Creation timestamp
	updated_at  u64     // Last update timestamp
}

Markdown represents a Markdown document library item

fn (Markdown) title #

fn (mut m Markdown) title(title string) Markdown

title sets the title of the document (builder pattern)

fn (Markdown) description #

fn (mut m Markdown) description(description string) Markdown

description sets the description of the document (builder pattern)

fn (Markdown) content #

fn (mut m Markdown) content(content string) Markdown

content sets the content of the document (builder pattern)

fn (Markdown) word_count #

fn (m Markdown) word_count() u32

word_count estimates the word count of the markdown content

fn (Markdown) is_empty #

fn (m Markdown) is_empty() bool

is_empty checks if the markdown content is empty

struct Pdf #

@[heap]
struct Pdf {
pub mut:
	id          u32     // Unique PDF ID
	title       string  // Title of the PDF
	description ?string // Optional description of the PDF
	url         string  // URL of the PDF file
	page_count  u32     // Number of pages in the PDF
	created_at  u64     // Creation timestamp
	updated_at  u64     // Last update timestamp
}

Pdf represents a PDF document library item

fn (Pdf) title #

fn (mut p Pdf) title(title string) Pdf

title sets the title of the PDF (builder pattern)

fn (Pdf) description #

fn (mut p Pdf) description(description string) Pdf

description sets the description of the PDF (builder pattern)

fn (Pdf) url #

fn (mut p Pdf) url(url string) Pdf

url sets the URL of the PDF (builder pattern)

fn (Pdf) page_count #

fn (mut p Pdf) page_count(page_count u32) Pdf

page_count sets the page count of the PDF (builder pattern)

fn (Pdf) is_empty #

fn (p Pdf) is_empty() bool

is_empty checks if the PDF has no pages

struct Slide #

struct Slide {
pub mut:
	image_url   string  // URL of the slide image
	title       ?string // Optional slide title
	description ?string // Optional slide description
}

Slide represents a single slide in a slideshow

fn (Slide) url #

fn (mut s Slide) url(url string) Slide

url sets the image URL (builder pattern)

fn (Slide) title #

fn (mut s Slide) title(title string) Slide

title sets the slide title (builder pattern)

fn (Slide) description #

fn (mut s Slide) description(description string) Slide

description sets the slide description (builder pattern)

fn (Slide) has_title #

fn (s Slide) has_title() bool

has_title checks if the slide has a title

fn (Slide) has_description #

fn (s Slide) has_description() bool

has_description checks if the slide has a description

struct Slideshow #

@[heap]
struct Slideshow {
pub mut:
	id          u32     // Unique slideshow ID
	title       string  // Title of the slideshow
	description ?string // Optional description of the slideshow
	slides      []Slide // List of slides
	created_at  u64     // Creation timestamp
	updated_at  u64     // Last update timestamp
}

Slideshow represents a Slideshow library item (collection of images for slideshow)

fn (Slideshow) title #

fn (mut s Slideshow) title(title string) Slideshow

title sets the title of the slideshow (builder pattern)

fn (Slideshow) description #

fn (mut s Slideshow) description(description string) Slideshow

description sets the description of the slideshow (builder pattern)

fn (Slideshow) add_slide #

fn (mut s Slideshow) add_slide(slide Slide) Slideshow

add_slide adds a slide to the slideshow (builder pattern)

fn (Slideshow) slide_count #

fn (s Slideshow) slide_count() u32

slide_count returns the number of slides

fn (Slideshow) get_slide #

fn (s Slideshow) get_slide(index u32) ?Slide

get_slide gets a slide by index (0-based)

fn (Slideshow) is_empty #

fn (s Slideshow) is_empty() bool

is_empty checks if the slideshow has no slides

fn (Slideshow) remove_slide #

fn (mut s Slideshow) remove_slide(index u32)

remove_slide removes a slide by index

struct TocEntry #

struct TocEntry {
pub mut:
	title       string     // Title of the chapter/section
	page        u32        // Page number (index in the pages array)
	subsections []TocEntry // Optional subsections
}

TocEntry represents a table of contents entry for a book

fn (TocEntry) title #

fn (mut te TocEntry) title(title string) TocEntry

title sets the title of the TOC entry (builder pattern)

fn (TocEntry) page #

fn (mut te TocEntry) page(page u32) TocEntry

page sets the page number of the TOC entry (builder pattern)

fn (TocEntry) add_subsection #

fn (mut te TocEntry) add_subsection(subsection TocEntry) TocEntry

add_subsection adds a subsection to the TOC entry (builder pattern)

fn (TocEntry) has_subsections #

fn (te TocEntry) has_subsections() bool

has_subsections checks if the TOC entry has subsections