Skip to content

Commit

Permalink
Added loops for relationships and columns. Started.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnbdz committed Nov 18, 2024
1 parent 662da6c commit bd98c4a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions cache/database/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type Column struct {
Constraint string
}

// Relationships so to create relationships
type Relationships struct {
ColumnName string
ReferencesTableName string
Expand Down
20 changes: 17 additions & 3 deletions cache/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,25 @@ func (s *SParser) Entity(entity entity.Entity) ([]database.Table, error) {
// TODO: For `Id` always: `Id TEXT PRIMARY KEY,`
// TODO: Maybe always have `NOT NULL` as a constrain. E.g.: name TEXT NOT NULL

//entityBody := entity.Content.Body
entityBody := entity.Content.Body

/*for _, bodyProperty := range entityBody {
// TODO: It needs data type and constrain
var dynamicColumns []database.Column
for key, value := range entityBody {
//dataType := determineDataType(value)
// TODO: Lookup the JsonSchema for the datatype
dynamicColumns = append(dynamicColumns, database.Column{
ColumnName: key,
DataType: "", //dataType,
Constraint: "", // TODO: Maybe there is something we can use from json schema (unique, require, etc)
})
}

}*/
// TODO:
var dynamicRelationships []database.Relationships
for key, value := range entityBody {
dynamicRelationships = append(dynamicRelationships, database.Relationships{})
}

return []database.Table{
{
Expand Down

0 comments on commit bd98c4a

Please sign in to comment.