Documentation
¶
Index ¶
- Variables
- func ColumnNamesCsvCNT(inclPK bool) string
- func ColumnNamesCsvINB(inclPK bool) string
- func ColumnNamesCsvTRF(inclPK bool) string
- func ColumnPtrsFuncCNT(acro DRM.RowModel, inclPK bool) []any
- func ColumnPtrsFuncINB(ainbro DRM.RowModel, inclPK bool) []any
- func ColumnPtrsFuncTRF(atro DRM.RowModel, inclPK bool) []any
- type ContentityRow
- func (cro *ContentityRow) ColumnNamesCsv(inclPK bool) string
- func (cro *ContentityRow) ColumnPtrsMethod(inclPK bool) []any
- func (p *ContentityRow) Debug() string
- func (p *ContentityRow) Echo() string
- func (p *ContentityRow) Info() string
- func (p *ContentityRow) String() string
- func (cro *ContentityRow) TableDetails() DRM.TableDetails
- type InbatchRow
- func (cro *InbatchRow) ColumnNamesCsv(inclPK bool) string
- func (inbro *InbatchRow) ColumnPtrsMethod(inclPK bool) []any
- func (p *InbatchRow) Debug() string
- func (p *InbatchRow) Echo() string
- func (p *InbatchRow) Info() string
- func (p *InbatchRow) String() string
- func (inb *InbatchRow) TableDetails() DRM.TableDetails
- type TopicrefRow
- func (tro *TopicrefRow) ColumnNamesCsv(inclPK bool) string
- func (tro *TopicrefRow) ColumnPtrsMethod(inclPK bool) []any
- func (p *TopicrefRow) Debug() string
- func (p *TopicrefRow) Echo() string
- func (p *TopicrefRow) Info() string
- func (p *TopicrefRow) String() string
- func (tro *TopicrefRow) TableDetails() DRM.TableDetails
Constants ¶
This section is empty.
Variables ¶
var ColumnNamesCsv_CNT = "IDX_inbatch, RelFP, AbsFP, Descr, T_Cre, T_Imp, T_Edt, " +
"RawMT, Mimtp, MType, Contt"
ColumnNamesCsv_CNT TODO: this can be left unset and then (easily!) auto-generated from ColumnSpecsCNT.
var ColumnNamesCsv_INB = "FilCt, Descr, T_Cre, T_Imp, T_Edt, RelFP, AbsFP"
ColumnNamesCsv_INB is TODO: It should be auto-generated!
var ColumnNamesCsv_TRF = "idx_cnt_map, idx_cnt_tpc"
ColumnNamesCsv_TRF is TODO: It should be auto-generated!
var ColumnSpecsCNT = []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.SFT_FTEXT.DT(), "descr", "Description", "Content entity description"}, D.DD_T_Cre, D.DD_T_Imp, D.DD_T_Edt, D.ColumnSpec{D.SFT_TOKEN.DT(), "rawmt", "Markup type", "Raw markup type"}, D.ColumnSpec{D.SFT_STRNG.DT(), "mimtp", "MIME type", "MIME type"}, D.ColumnSpec{D.SFT_STRNG.DT(), "mtype", "MType", "MType"}, D.ColumnSpec{D.SFT_FTEXT.DT(), "contt", "Content", "Entity raw content"}, }
ColumnSpecsCNT field order MUST be kept in sync with ColumnNamesCsvCNT and [ColumnPtrsCNT] and it specifies:
- a primary key (actually, it does NOT - 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)
.
var ColumnSpecsINB = []D.ColumnSpec{ D.ColumnSpec{D.SFT_COUNT.DT(), "filct", "Nr. of files", "Number of files"}, D.ColumnSpec{D.SFT_FTEXT.DT(), "descr", "Batch descr.", "Inbatch description"}, D.DD_T_Cre, D.DD_T_Imp, D.DD_T_Edt, D.DD_RelFP, D.DD_AbsFP, }
ColumnSpecsINB field order MUST be kept in sync with ColumnNamesCsvINB and [ColumnPtrsINB]. It specifies:
- file count
- two path fields (rel & abs) (placed at the end because they tend to be looong)
- three time fields (creation, import, last-edit) (the meaning of creation is TBD)
- description
- NOT the primary key, which is handled automatically
.
var ColumnSpecsTRF = []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"}, }
ColumnSpecsTRF field order MUST be kept in sync with ColumnNamesCsvTRF and [ColumnPtrsTRF] and it specifies:
- the primary index into table "contentity" of the map that makes the reference
- the primary index into table "contentity" of the topic that is referred to
- NOT the primary key, which is handled automatically
Note that it is unclear ATM so far whether this table also includes maps referring to submaps, or topics referring to other topics. .
var M5_TableDetails = []DRM.TableDetails{ TableDetailsCNT, TableDetailsINB, TableDetailsTRF, }
M5_TableDetails configures the three key tables.
var PKSpecCNT = D.ColumnSpec{D.SFT_PRKEY.DT(),
"idx_contentity", "Pri.key", "Primary key"}
PKSpecCNT should be auto.generated!
var PKSpecINB = D.ColumnSpec{D.SFT_PRKEY.DT(),
"idx_inbatch", "Pri.key", "Primary key"}
PKSpecINB specifies the table's primary key. TODO: It should be auto.generated!
var PKSpecTRF = D.ColumnSpec{D.SFT_PRKEY.DT(),
"idx_topicref", "Pri.key", "Primary key"}
PKSpecTRF specifies the table's primary key. TODO: It should be auto.generated!
var TableDetailsCNT = DRM.TableDetails{ TableSummaryCNT, "idx_contentity", "IDX_inbatch, RelFP, AbsFP, Descr, T_Cre, T_Imp, T_Edt, " + "RawMT, Mimtp, MType, Contt", ColumnSpecsCNT, ColumnPtrsFuncCNT, &ContentityRow{}, }
TableDetailsCNT specifies 11 DB columns, incl primary key (assumed) and one foreign key, "inbatch".
var TableDetailsINB = DRM.TableDetails{ TableSummaryINB, "idx_inbatch", ColumnNamesCsv_INB, ColumnSpecsINB, ColumnPtrsFuncINB, &InbatchRow{}, }
TableDetailsINB TBS has no foreign keys.
var TableDetailsTRF = DRM.TableDetails{ TableSummaryTRF, "idx_topicref", ColumnNamesCsv_TRF, ColumnSpecsTRF, ColumnPtrsFuncTRF, &TopicrefRow{}, }
TableDetailsTRF specifies only two foreign keys.
var TableSummaryCNT = D.TableSummary{ D.SCT_TABLE.DT(), "contentity", "cnt", "Content entity"}
TableSummaryCNT summarizes the table.
var TableSummaryINB = D.TableSummary{ D.SCT_TABLE.DT(), "inbatch", "inb", "Input batch of imported files"}
var TableSummaryTRF = D.TableSummary{ D.SCT_TABLE.DT(), "topicref", "trf", "Reference from map to topic"}
Functions ¶
func ColumnNamesCsvCNT ¶
func ColumnNamesCsvINB ¶
ColumnNamesCsvINB is TODO: this can be left unset and then (easily!) auto-generated from ColumnSpecsINB.
func ColumnNamesCsvTRF ¶
ColumnNamesCsvTRF is TODO: this can be left unset and then (easily!) auto-generated from ColumnSpecsTRF.
func ColumnPtrsFuncCNT ¶
ColumnPtrsFuncCNT goes into a field in struct TableDetails and MUST be kept in sync:
- field order with ColumnSpecsCNT and ColumnNamesCsvCNT
- field names with ContentityRow
func ColumnPtrsFuncCNT(cro *ContentityRow, inclPK bool) []any {
func ColumnPtrsFuncINB ¶
ColumnPtrsFuncINB supplies a field in TableDetails. NOTE: It MUST be kept in sync:
- field order with ColumnSpecsINB and ColumnNamesCsvINB
- field names with InbatchRow
func ColumnPtrsFuncINB(inbro *InbatchRow, inclPK bool) []any {
func ColumnPtrsFuncTRF ¶
ColumnPtrsFuncTRF MUST be kept in sync:
- field order with [ColumnNamesCsvTRF] and ColumnSpecsTRF
- field names with TopicrefRow
func ColumnPtrsFuncTRF(tro *TopicrefRow, inclPK bool) []any {
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 // FSItem has Raw [the byte content) AND path and // name information AND whether it is a directory // (indicated by SU.MarkupType == MU_type_DIRLIKE). // NOTE that directory-like and byte-content are // mutually exclusive !! // CT.TypedRaw { Raw, SU.MarkupType string }; // RelFP, ShortFP string; // FileMeta { os.FileInfo, exists bool, MU.Errer } FU.FSItem // 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. Raw content is in [FSItem.TypedRaw.Raw] and directory typing is in [FSItem.TypedRaw.MarkupType] and they are MUTUALLY EXCLUSIVE.
func NewContentityRow ¶
func NewContentityRow(pFSI *FU.FSItem, pPA *CA.PathAnalysis) (*ContentityRow, error)
NewContentityRow does content fetching & analysis, while "promoting" an [FSItem]; it work for "Dirlike" (directories and symlinks) too. If the second argument is nil, the first argument is verified to be Dirlike. In such case (Dirlike), the return value *ContentityRow is basically a shell. .
func (*ContentityRow) ColumnNamesCsv ¶
func (cro *ContentityRow) ColumnNamesCsv(inclPK bool) string
func (*ContentityRow) ColumnPtrsMethod ¶
func (cro *ContentityRow) ColumnPtrsMethod(inclPK bool) []any
func (*ContentityRow) Debug ¶
func (p *ContentityRow) Debug() string
Debug implements Stringser FIXME
func (*ContentityRow) String ¶
func (p *ContentityRow) String() string
String implements Stringer FIXME
func (*ContentityRow) TableDetails ¶
func (cro *ContentityRow) TableDetails() DRM.TableDetails
TableDetails returns the table detail info, given any instance.
type InbatchRow ¶
type InbatchRow struct { Idx_Inbatch int FilCt int Descr string RelFP string AbsFP FU.AbsFilePath T_Cre string T_Imp string T_Edt string }
InbatchRow describes (in the DB) a single import batch (probably at the CLI field names); field names MUST be kept in sync with [ColumnPtrsINB].
- NOTE: Maybe rename Inbatch* to FileSet* (and INB to FLS) ?
- TODO: Maybe represent this (or, each file) with a dsmnd.NSPath: Batch.nr+Path
func (*InbatchRow) ColumnNamesCsv ¶
func (cro *InbatchRow) ColumnNamesCsv(inclPK bool) string
func (*InbatchRow) ColumnPtrsMethod ¶
func (inbro *InbatchRow) ColumnPtrsMethod(inclPK bool) []any
ColumnPtrsMethod is NOTE: Maybe do the "switch (Rowmodeler).RowmodelImplName" trick here.
func (*InbatchRow) TableDetails ¶
func (inb *InbatchRow) TableDetails() DRM.TableDetails
TableDetails returns the table detail info, given any instance.
type TopicrefRow ¶
TopicrefRow describes (in the DB) a reference from a Map (i.e. TOC) to a Topic; field names MUST be kept in sync with [ColumnPtrsTRF].
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 map might explicitly reference a particular topic more than once. So for simplicity, let's create only one TopicrefRow per map/topic pair, and see if it creates problems elsewhere later on. Maybe a record also needs a "count" field.
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) ColumnNamesCsv ¶
func (tro *TopicrefRow) ColumnNamesCsv(inclPK bool) string
func (*TopicrefRow) ColumnPtrsMethod ¶
func (tro *TopicrefRow) ColumnPtrsMethod(inclPK bool) []any
ColumnPtrsMethod is NOTE: Maybe do the "switch (Rowmodeler).RowmodelImplName" trick here.
func (*TopicrefRow) TableDetails ¶
func (tro *TopicrefRow) TableDetails() DRM.TableDetails
TableDetails returns the table detail info, given any instance.