Documentation
¶
Index ¶
- Constants
- Variables
- func CreateOrUpdateDocsTable(ctx context.Context, root *doltdb.RootValue, docs Docs) (*doltdb.Table, error)
- func DeleteDoc(fs filesys.ReadWriteFS, docName string) error
- func DocFileExists(fs filesys.ReadWriteFS, file string) bool
- func GetDocFilePath(filename string) string
- func GetDocNamesFromDocs(docs Docs) []string
- func GetLocalFileText(fs filesys.Filesys, file string) ([]byte, error)
- func UpdateRootWithDocs(ctx context.Context, root *doltdb.RootValue, docs Docs) (*doltdb.RootValue, error)
- type Doc
- type Docs
Constants ¶
const ( ReadmeFile = "../README.md" LicenseFile = "../LICENSE.md" // LicenseDoc is the key for accessing the license within the docs table LicenseDoc = "LICENSE.md" // ReadmeDoc is the key for accessing the readme within the docs table ReadmeDoc = "README.md" )
Variables ¶
var DocsSchema = schema.MustSchemaFromCols(doltDocsColumns)
var ErrDocsUpdate = errors.New("error updating local docs")
var ErrEmptyDocsTable = errors.New("error: All docs removed. Removing Docs Table")
var ErrMarshallingSchema = errors.New("error marshalling schema")
var SupportedDocs = Docs{ {DocPk: ReadmeDoc, File: ReadmeFile}, {DocPk: LicenseDoc, File: LicenseFile}, }
Functions ¶
func CreateOrUpdateDocsTable ¶
func CreateOrUpdateDocsTable(ctx context.Context, root *doltdb.RootValue, docs Docs) (*doltdb.Table, error)
CreateOrUpdateDocsTable takes a root value and a set of docs and either creates the docs table or updates it with docs.
func DeleteDoc ¶
func DeleteDoc(fs filesys.ReadWriteFS, docName string) error
DeleteDoc takes in a filesytem object and deletes the file with docName, if it's a SupportedDoc.
func DocFileExists ¶
func DocFileExists(fs filesys.ReadWriteFS, file string) bool
func GetDocFilePath ¶
GetDocFilePath takes in a filename and appends it to the DoltDir filepath.
func GetDocNamesFromDocs ¶
func GetLocalFileText ¶
GetLocalFileText returns a byte slice representing the contents of the provided file, if it exists
func UpdateRootWithDocs ¶
func UpdateRootWithDocs(ctx context.Context, root *doltdb.RootValue, docs Docs) (*doltdb.RootValue, error)
UpdateRootWithDocs takes in a root value, and some docs and writes those docs to the dolt_docs table (perhaps creating it in the process). The table might not necessarily need to be created if there are no docs in the repo yet.
Types ¶
type Doc ¶
func IsSupportedDoc ¶
type Docs ¶
type Docs []Doc
func GetAllDocs ¶
GetAllDocs takes a root value and returns all the docs available in the root.
func GetDocsFromRoot ¶
GetDocsFromRoot takes in a root value and returns the docs stored in its dolt_docs table.
func GetSupportedDocs ¶
GetSupportedDocs takes in a filesystem and returns the contents of all docs on disk.