rowmodels

package module
v0.0.0-...-15e51e4 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: MIT Imports: 5 Imported by: 1

README

rowmodels

Go structs for persistent data for mixed content processor

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ColumnSpecs_ContentityRow = []D.ColumnSpec{
	D.ColumnSpec{D.SFT_FRKEY.DT(), "idx_inbatch", "inbatch",
		"Input batch of imported content"},
	D.DD_RelFP,
	D.DD_AbsFP,
	D.ColumnSpec{D.BDT_TEXT.DT(), "descr", "Description",
		"Content entity description"},
	D.DD_T_Cre,
	D.DD_T_Imp,
	D.DD_T_Edt,
	D.ColumnSpec{D.BDT_TEXT.DT(), "rawmt", "Markup type", "Raw markup type"},
	D.ColumnSpec{D.BDT_TEXT.DT(), "mimtp", "MIME type", "MIME type"},
	D.ColumnSpec{D.BDT_TEXT.DT(), "mtype", "MType", "MType"},
	D.ColumnSpec{D.BDT_TEXT.DT(), "contt", "Content", "Entity raw content"},
}

ColumnSpecs_ContentityRow specifies

  • a primary key (actually, it doescNOT - a primary key is assumed, and handled elsewhere)
  • a foreign key "inbatch"
  • two path fields (rel & abs)
  • three time fields (creation, import, last-edit)
  • a description
  • three content-type fields (raw markup type, MIME-type, MType) NOTE: these are persisted in the DB because
  • - they are useful in searching thru content
  • - they can be expensive to calculate at import time
  • - they can be overridden by choices made by users
  • the content itself
  • (not for now!) XML content type and XML DOCTYPE
  • (not for now!) two LwDITA fields (flavor [xdita,hdita!,mdita]), LwDITA content type)

.

View Source
var ColumnSpecs_InbatchRow = []D.ColumnSpec{
	D.ColumnSpec{D.BDT_INTG.DT(), "filct",
		"Nr. of files", "Number of files"},
	D.DD_RelFP,
	D.DD_AbsFP,
	D.DD_T_Cre,

	D.ColumnSpec{D.BDT_TEXT.DT(), "descr",
		"Batch descr.", "Inbatch description"},
}

ColumnSpecs_InbatchRow specifies:

  • file count
  • two path fields (rel & abs)
  • creation time
  • description

.

View Source
var ColumnSpecs_TopicrefRow = []D.ColumnSpec{
	D.ColumnSpec{D.SFT_FRKEY.DT(), "idx_cnt_map", "contentity",
		"Referencing map"},
	D.ColumnSpec{D.SFT_FRKEY.DT(), "idx_cnt_tpc", "contentity",
		"Referenced topic"},
}

ColumnSpecs_TopicrefRow is empty, cos the table contains only foreign keys.

MmmcTableDescriptors configures the three key tables.

View Source
var TableDescriptor_ContentityRow = DRU.TableDescriptor{
	"contentity",
	"cnt",
	"idx_contentity",
	"RelFP, AbsFP, Descr, T_Cre, T_Imp, T_Edt, " +
		"RawMT, Mimtp, MType, Contt",

	ColumnSpecs_ContentityRow,
}

incl primary key (assumed) and one foreign key, "inbatch".

View Source
var TableDescriptor_InbatchRow = DRU.TableDescriptor{
	"inbatch",
	"inb",
	"idx_inbatch",

	"FilCt, RelFP, AbsFP, T_Cre, Descr",

	ColumnSpecs_InbatchRow,
}

RENAME THIS TO TableDetails_* and USE THE TABLE SUMMARY/DESCRIPTOR JUST ABOVE TableDescriptor_InbatchRow TBS and no foreign keys.

View Source
var TableDescriptor_TopicrefRow = DRU.TableDescriptor{
	"topicref",
	"trf",
	"idx_topicref",

	"idx_map_contentity, idx_tpc_contentity",

	ColumnSpecs_TopicrefRow,
}

TableDescriptor_TopicrefRow specifies only two foreign keys.

View Source
var TableSummary_ContentityRow = D.TableSummary{
	D.SCT_TABLE.DT(), "contentity", "cnt", "Content entity"}

TableSummary_ContentityRow summarizes the table.

View Source
var TableSummary_InbatchRow = D.TableSummary{
	D.SCT_TABLE.DT(), "INB", "inbatch", "Input batch of imported files"}

RENAME THIS TO TableDescriptor_* TableSummary_InbatchRow describes the table.

View Source
var TableSummary_TopicrefRow = D.TableSummary{D.SCT_TABLE.DT(),
	"trf", "topicref", "Reference from map to topic"}

TableSummary_TopicrefRow describes the table.

Functions

This section is empty.

Types

type ContentityRow

type ContentityRow struct {
	Idx_Contentity int
	Idx_Inbatch    int // NOTE: Rename to FILESET? Could be multiple?
	Descr          string
	// Times is T_Cre, T_Imp, T_Edt string
	DRU.Times
	// PathProps has Raw and is // => EntityProps !!
	// CT.TypedRaw { Raw, SU.MarkupType string };
	// RelFP, ShortFP string;
	// FileMeta { os.FileInfo, exists bool, MU.Errer }
	FU.PathProps
	// PathAnalysis is a ptr, so that we get a
	// NPE if it is not initialized properly;
	// or if analysis failed, if (for example)
	// the content is too short.
	// FU.PathAnalysis is
	// XU.ContypingInfo { FileExt, MimeType, =>
	//   MimeTypeAsSnift, MType string }
	// ContentityBasics { XmlRoot, Text, Meta CT.Span; // => TopLevel !!
	//     MetaFormat string; MetaProps SU.PropSet }
	// XmlContype string
	// *XU.ParsedPreamble
	// *XU.ParsedDoctype
	// DitaFlavor  string
	// DitaContype string
	*CA.PathAnalysis // NEED DETAIL

}

ContentityRow describes (in the DB) the entity's content plus its "dead properties" - basically, properties that are set by the user, rather than calculated as needed. Has the entity Raw content, in [PathProps.TypedRaw.Raw].

func (*ContentityRow) PtrFields

func (cro *ContentityRow) PtrFields() []any

PtrFields implements interface [Row]. TODO: Still can't sort out the notation for ptr constraints ?!

func (*ContentityRow) String

func (p *ContentityRow) String() string

FIXME: String implements Stringer.

type InbatchRow

type InbatchRow struct {
	Idx_Inbatch int
	FilCt       int
	RelFP       string
	AbsFP       FU.AbsFilePath
	T_Cre       string
	// Batch "name" ? Or add a separate Name field ?
	Descr string
}

InbatchRow describes (in the DB) a single import batch at the CLI.

  • NOTE: Maybe rename this to FileSet ?
  • TODO: Maybe represent this with a dsmnd.NSPath: Batch.nr+Path

func (*InbatchRow) PtrFields

func (inbro *InbatchRow) PtrFields() []any

TODO: Still can't sort out the notation for ptr constraints ?!

func (*InbatchRow) String

func (p *InbatchRow) String() string

String implements Stringer. FIXME

type TopicrefRow

type TopicrefRow struct {
	Idx_Topicref       int
	Idx_Map_Contentity int
	Idx_Tpc_Contentity int
}

TopicrefRow describes a reference from a Map (i.e. TOC) to a Topic. Note that "Topic" does NOT necessarily refer to a DITA `topictref` element!

The relationship is N-to-N btwn Maps and Topics, so a TopicrefRow might not be unique because a topic might be explicitly referenced more than once by a map. So for simplicity, let's create only one TopicrefRow per topic per map file, and see if it creates problems elsewhere later on.

Note also that if we decide to use multi-trees, then perhaps these links can count not just as kids for maps, but also as parents for topics.

func (*TopicrefRow) PtrFields

func (tro *TopicrefRow) PtrFields() []any

TODO: Still can't sort out the notation for ptr constraints ?!

func (*TopicrefRow) String

func (p *TopicrefRow) String() string

String implements Stringer. FIXME

Jump to

Keyboard shortcuts

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