models

package
v0.0.0-...-0a0c50c Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2023 License: MIT Imports: 3 Imported by: 4

Documentation

Overview

Package models contains the data models used in the application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cell

type Cell struct {
	ID         string      `json:"id"`
	WorkbookID string      `json:"workbook_id"`
	SheetID    string      `json:"sheet_id"`
	Row        int         `json:"row"`
	Column     string      `json:"column"`
	Value      interface{} `json:"value"`
}

Cell represents a single cell in a spreadsheet

func NewCell

func NewCell(workbook_id string, sheet_id string, row int, column string, value interface{}, id string) (*Cell, error)

NewCell creates a new Cell instance. If id is empty, a new UUID will be generated.

func (*Cell) GetPosition

func (c *Cell) GetPosition() string

GetPosition returns the position of the cell as a string, concatenating the column and row information.

type Extension

type Extension string

Extension represents the type of file extension for a workbook.

const (
	XLSX  Extension = "xlsx" // Standard Excel workbook
	XLSXM Extension = "xlsm" // Excel workbook with macros
	XLS   Extension = "xls"  // Excel 97-2003 workbook
)

File extension types for Excel workbooks.

type Sheet

type Sheet struct {
	ID         string `json:"id"`
	WorkbookID string `json:"workbook_id"`
	Pos        int    `json:"pos"`   // Position of the sheet within the spreadsheet
	Name       string `json:"name"`  // Name of the sheet
	Cells      []Cell `json:"cells"` // Collection of cells within the sheet
}

Sheet represents a single worksheet within a spreadsheet. It contains a collection of cells, a name, and a position.

func NewSheet

func NewSheet(workbookdId string, pos int, name, id string) (*Sheet, error)

NewSheet creates a new Sheet instance. If id is empty, a new UUID will be generated.

type Workbook

type Workbook struct {
	ID         string    `json:"id"`
	FileName   string    `json:"file_name"`
	Extension  Extension `json:"extension"`   // File extension (e.g., xls, xlsx)
	FolderPath string    `json:"folder_path"` // Folder path where the workbook is located
	Sheets     []Sheet   `json:"sheets"`      // Sheets within the workbook
}

Workbook represents a spreadsheet file containing multiple sheets. It has an ID, file name, extension, and a folder path where it is located.

func NewWorkbook

func NewWorkbook(fileName string, extension Extension, folderPath, id string) (*Workbook, error)

NewWorkbook initializes a new Workbook instance. If id is not provided, a new UUID will be generated.

func (*Workbook) GetFullPath

func (e *Workbook) GetFullPath() string

GetFullPath constructs and returns the full path of the workbook.

Jump to

Keyboard shortcuts

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