Documentation
¶
Overview ¶
Package models4datatug holds this extension's database objects and the dalgo keys they are stored under. Like the rest of the module it depends on dal-go only — no database client, no platform package.
Index ¶
Constants ¶
const ( // ProjectsCollection stores DataTug projects. ProjectsCollection = "datatug_projects" // UsersCollection is the platform's users collection. UsersCollection = "users" // UserExtCollection is the platform's collection of per-extension user // documents: users/{userID}/ext/{extID}. The DataTug extension's user data // (which stores and projects the user can see) lives there, never inline in // the core users/{userID} document. This mirrors the key that // sneat-core-modules' dal4userus.NewUserExtKey builds; the module builds it // itself so that it depends on dal-go only. UserExtCollection = "ext" // FirestoreStoreID is the store id of the DataTug cloud store. It is what // the web client sends as `?store=` and the key of the store brief in the // user's index. FirestoreStoreID = "firestore" // FirestoreStoreTitle is the human-readable title of the cloud store. FirestoreStoreTitle = "DataTug cloud" // GithubStoreID is the store id of a project hosted in a GitHub repository — // the id the web client's GitHub reader and navigation use. GithubStoreID = "github.com" // GithubStoreType is the store type reported for GitHub-hosted projects. GithubStoreType = "github" // GithubStoreTitle is the human-readable title of the GitHub store. GithubStoreTitle = "GitHub" // DefaultGithubProjectFolder is the repo folder a project lives in when the // user does not name one — the same default the web client's // parseGithubProjectId() applies. DefaultGithubProjectFolder = "datatug" // AccessPrivate means only the userIDs listed on the project can read it. AccessPrivate = "private" )
Variables ¶
This section is empty.
Functions ¶
func NewGithubProjectID ¶ added in v0.2.0
NewGithubProjectID builds the id a GitHub-hosted project is addressed by: `repo@org@folder` — the format the web client's parseGithubProjectId() expects.
func NewProjectKey ¶
NewProjectKey builds the dalgo key of a project record.
func NewUserExtKey ¶
NewUserExtKey builds the dalgo key of a user's DataTug index record: users/{userID}/ext/{extID}.
Types ¶
type Project ¶
type Project struct {
Title string `json:"title" firestore:"title"`
Access string `json:"access,omitempty" firestore:"access,omitempty"`
UserIDs []string `json:"userIDs,omitempty" firestore:"userIDs,omitempty"`
Created *Created `json:"created,omitempty" firestore:"created,omitempty"`
}
Project is the data stored in a datatug_projects/{projectID} record.
type ProjectBrief ¶
type ProjectBrief struct {
Title string `json:"title" firestore:"title"`
Access string `json:"access,omitempty" firestore:"access,omitempty"`
}
ProjectBrief is a brief of one project in a user's DataTug index.
type StoreBrief ¶
type StoreBrief struct {
Title string `json:"title" firestore:"title"`
Type string `json:"type" firestore:"type"`
URL string `json:"url,omitempty" firestore:"url,omitempty"`
Projects map[string]*ProjectBrief `json:"projects,omitempty" firestore:"projects,omitempty"`
}
StoreBrief is a brief of one store in a user's DataTug index.
type UserExt ¶
type UserExt struct {
Stores map[string]*StoreBrief `json:"stores,omitempty" firestore:"stores,omitempty"`
}
UserExt is the DataTug extension data of one user: the index of the DataTug stores the user can see, and the project briefs inside each of them. It is the data of the users/{userID}/ext/datatug record.