repository

package
v1.0.0-main.55 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const ChapterCollection = "chapters"
View Source
const GraphCollection = "graphs"
View Source
const PaperCollection = "papers"
View Source
const ProjectCollection = "projects"

Variables

This section is empty.

Functions

This section is empty.

Types

type ChapterRepository

type ChapterRepository interface {
	FetchChapters(
		userId string,
		projectId string,
	) (map[string]record.ChapterEntry, *Error)
	FetchChapter(
		userId string,
		projectId string,
		chapterId string,
	) (*record.ChapterEntry, *Error)
	InsertChapter(
		userId string,
		projectId string,
		entry record.ChapterWithoutAutofieldEntry,
	) (string, *record.ChapterEntry, *Error)
	UpdateChapter(
		userId string,
		projectId string,
		chapterId string,
		entry record.ChapterWithoutAutofieldEntry,
	) (*record.ChapterEntry, *Error)
	UpdateChapterSections(
		userId string,
		projectId string,
		chapterId string,
		entries []record.SectionWithoutAutofieldEntry,
	) ([]record.SectionEntry, *Error)
	DeleteChapter(
		userId string,
		projectId string,
		chapterId string,
	) *Error
}

func NewChapterRepository

func NewChapterRepository(client firestore.Client) ChapterRepository

type Error

type Error struct {
	// contains filtered or unexported fields
}

func Errorf

func Errorf(code ErrorCode, format string, args ...any) *Error

func (Error) Code

func (e Error) Code() ErrorCode

func (Error) Error

func (e Error) Error() string

func (Error) Unwrap

func (e Error) Unwrap() error

type ErrorCode

type ErrorCode string
const (
	InvalidArgumentError ErrorCode = "invalid argument"
	NotFoundError        ErrorCode = "not found"
	ReadFailurePanic     ErrorCode = "read failure"
	WriteFailurePanic    ErrorCode = "write failure"
)

type GraphRepository

type GraphRepository interface {
	GraphExists(
		userId string,
		projectId string,
		chapterId string,
	) (bool, *Error)
	FetchGraph(
		userId string,
		projectId string,
		chapterId string,
		sectionId string,
	) (*record.GraphEntry, *Error)
	InsertGraphs(
		userId string,
		projectId string,
		chapterId string,
		entries []record.GraphWithoutAutofieldEntry,
	) ([]string, []record.GraphEntry, *Error)
	UpdateGraphContent(
		userId string,
		projectId string,
		chapterId string,
		sectionId string,
		entry record.GraphContentEntry,
	) (*record.GraphEntry, *Error)
	DeleteGraph(
		userId string,
		projectId string,
		chapterId string,
		sectionId string,
	) *Error
}

func NewGraphRepository

func NewGraphRepository(client firestore.Client) GraphRepository

type PaperRepository

type PaperRepository interface {
	FetchPaper(
		userId string,
		projectId string,
		chapterId string,
	) (*record.PaperEntry, *Error)
	InsertPaper(
		userId string,
		projectId string,
		chapterId string,
		entry record.PaperWithoutAutofieldEntry,
	) (string, *record.PaperEntry, *Error)
	UpdatePaper(
		userId string,
		projectId string,
		chapterId string,
		entry record.PaperWithoutAutofieldEntry,
	) (*record.PaperEntry, *Error)
	DeletePaper(
		userId string,
		projectId string,
		chapterId string,
	) *Error
}

func NewPaperRepository

func NewPaperRepository(client firestore.Client) PaperRepository

type ProjectRepository

type ProjectRepository interface {
	FetchProjects(
		userId string,
	) (map[string]record.ProjectEntry, *Error)
	FetchProject(
		userId string,
		projectId string,
	) (*record.ProjectEntry, *Error)
	InsertProject(
		userId string,
		entry record.ProjectWithoutAutofieldEntry,
	) (string, *record.ProjectEntry, *Error)
	UpdateProject(
		userId string,
		projectId string,
		entry record.ProjectWithoutAutofieldEntry,
	) (*record.ProjectEntry, *Error)
	DeleteProject(
		userId string,
		projectId string,
	) *Error
}

func NewProjectRepository

func NewProjectRepository(client firestore.Client) ProjectRepository

Jump to

Keyboard shortcuts

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