-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: new getting-started sections, a bit of reorg, code fmt (#366)
Co-authored-by: Tony Worm <tony@topcialsource.com>
- Loading branch information
Showing
64 changed files
with
1,239 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "Dougie", | ||
"question": "Did you see all them turtles?", | ||
"answer": "They went all the way down!" | ||
"name": "Dougie", | ||
"question": "Did you see all them turtles?", | ||
"answer": "They went all the way down!" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
2 changes: 0 additions & 2 deletions
2
.../code/getting-started/data-layer/.hof/shadow/migrations/out/migrations/000-extensions.sql
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package datamodel | ||
|
||
import ( | ||
"github.com/hofstadter-io/hof/schema/dm/sql" | ||
"github.com/hofstadter-io/hof/schema/dm/fields" | ||
) | ||
|
||
// Traditional database model which maps onto tables & columns. | ||
Datamodel: sql.Datamodel & { | ||
Models: { | ||
User: { | ||
Fields: { | ||
ID: fields.UUID | ||
CreatedAt: fields.Datetime | ||
UpdatedAt: fields.Datetime | ||
DeletedAt: fields.Datetime | ||
|
||
email: fields.Email | ||
username: fields.String | ||
password: fields.Password | ||
verified: fields.Bool | ||
active: fields.Bool | ||
|
||
persona: fields.Enum & { | ||
Vals: ["guest", "user", "admin", "owner"] | ||
Default: "user" | ||
} | ||
} | ||
} | ||
} | ||
} |
236 changes: 236 additions & 0 deletions
236
docs/code/getting-started/data-layer/create/hof-eval.cue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,236 @@ | ||
// Traditional database model which maps onto tables & columns. | ||
Datamodel: { | ||
// schema for #hof: ... | ||
#hof: { | ||
// #hof version | ||
apiVersion: "v1beta1" | ||
|
||
// typical metadata | ||
metadata: {} | ||
|
||
// hof/datamodel | ||
datamodel: { | ||
// define the root of a datamodel | ||
root: true | ||
|
||
// instruct history to be tracked | ||
history: true | ||
|
||
// instruct ordrered version of the fields | ||
// to be injected as a peer value | ||
ordered: false | ||
|
||
// tell hof this is a node of interest for | ||
// the inspection commands (list,info) | ||
node: false | ||
|
||
// tell hof to track this as a raw CUE value | ||
// (partially implemented) | ||
cue: false | ||
} | ||
} | ||
Snapshot: { | ||
Timestamp: "" | ||
} | ||
|
||
// these are the models for the application | ||
// they can map onto database tables and apis | ||
Models: { | ||
User: { | ||
// for easy access | ||
Name: "User" | ||
Plural: "Users" | ||
|
||
// These are the fields of a model | ||
// they can map onto database columnts and form fields | ||
Fields: { | ||
ID: { | ||
Name: "ID" | ||
Plural: "IDs" | ||
Type: "uuid" | ||
Nullable: false | ||
Unique: true | ||
Validation: { | ||
Format: "uuid" | ||
} | ||
#hof: { | ||
metadata: { | ||
name: "ID" | ||
} | ||
} | ||
} | ||
CreatedAt: { | ||
Name: "CreatedAt" | ||
Plural: "CreatedAts" | ||
Type: "datetime" | ||
#hof: { | ||
metadata: { | ||
name: "CreatedAt" | ||
} | ||
} | ||
} | ||
UpdatedAt: { | ||
Name: "UpdatedAt" | ||
Plural: "UpdatedAts" | ||
Type: "datetime" | ||
#hof: { | ||
metadata: { | ||
name: "UpdatedAt" | ||
} | ||
} | ||
} | ||
DeletedAt: { | ||
Name: "DeletedAt" | ||
Plural: "DeletedAts" | ||
Type: "datetime" | ||
#hof: { | ||
metadata: { | ||
name: "DeletedAt" | ||
} | ||
} | ||
} | ||
email: { | ||
Name: "email" | ||
Plural: "emails" | ||
Type: "string" | ||
Length: 64 | ||
Unique: true | ||
Nullable: false | ||
Validation: { | ||
Max: 64 | ||
Format: "email" | ||
} | ||
#hof: { | ||
metadata: { | ||
name: "email" | ||
} | ||
} | ||
} | ||
username: { | ||
Name: "username" | ||
Plural: "usernames" | ||
Type: "string" | ||
Length: 64 | ||
Unique: false | ||
Nullable: false | ||
Validation: { | ||
Max: 64 | ||
} | ||
#hof: { | ||
metadata: { | ||
name: "username" | ||
} | ||
} | ||
} | ||
password: { | ||
Name: "password" | ||
Plural: "passwords" | ||
Bcrypt: true | ||
Type: "string" | ||
Length: 64 | ||
Unique: false | ||
Nullable: false | ||
Validation: { | ||
Max: 64 | ||
} | ||
#hof: { | ||
metadata: { | ||
name: "password" | ||
} | ||
} | ||
} | ||
verified: { | ||
Name: "verified" | ||
Plural: "verifieds" | ||
Type: "bool" | ||
Default: "false" | ||
Nullable: false | ||
#hof: { | ||
metadata: { | ||
name: "verified" | ||
} | ||
} | ||
} | ||
active: { | ||
Name: "active" | ||
Plural: "actives" | ||
Type: "bool" | ||
Default: "false" | ||
Nullable: false | ||
#hof: { | ||
metadata: { | ||
name: "active" | ||
} | ||
} | ||
} | ||
persona: { | ||
Name: "persona" | ||
Plural: "personas" | ||
Type: "string" | ||
Vals: ["guest", "user", "admin", "owner"] | ||
Nullable: false | ||
Default: "user" | ||
#hof: { | ||
metadata: { | ||
name: "persona" | ||
} | ||
} | ||
} | ||
#hof: { | ||
datamodel: { | ||
node: true | ||
ordered: true | ||
} | ||
} | ||
} | ||
|
||
// if we want Relations as a separate value | ||
// we can process the fields to extract them | ||
// schema for #hof: ... | ||
#hof: { | ||
// #hof version | ||
apiVersion: "v1beta1" | ||
|
||
// typical metadata | ||
metadata: { | ||
name: "User" | ||
} | ||
|
||
// hof/datamodel | ||
datamodel: { | ||
// define the root of a datamodel | ||
root: false | ||
|
||
// instruct history to be tracked | ||
history: true | ||
|
||
// instruct ordrered version of the fields | ||
// to be injected as a peer value | ||
ordered: false | ||
|
||
// tell hof this is a node of interest for | ||
// the inspection commands (list,info) | ||
node: false | ||
|
||
// tell hof to track this as a raw CUE value | ||
// (partially implemented) | ||
cue: false | ||
} | ||
} | ||
Snapshot: { | ||
Timestamp: "" | ||
} | ||
History: [] | ||
} | ||
#hof: { | ||
datamodel: { | ||
node: true | ||
ordered: true | ||
} | ||
} | ||
} | ||
|
||
// OrderedModels: [...Model] will be | ||
// inject here for order stability | ||
History: [] | ||
} |
2 changes: 0 additions & 2 deletions
2
docs/code/getting-started/data-layer/out/migrations/000-extensions.sql
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
docs/code/getting-started/data-layer/statics/migrations/000-extensions.sql
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.