1
0
mirror of https://github.com/garraflavatra/go-fmp.git synced 2025-06-28 04:25:11 +00:00

Parse table columns

This commit is contained in:
2025-06-15 21:09:58 +02:00
parent f7fef208f8
commit cc10a1e7b4
5 changed files with 159 additions and 53 deletions

View File

@ -38,4 +38,30 @@ func TestTables(t *testing.T) {
if !slicesHaveSameElements(tableNames, expectedNames) {
t.Errorf("tables do not match")
}
var field FmpColumn
for _, table := range tables {
for _, column := range table.Columns {
if column.Name == "PrimaryKey" {
field = column
break
}
}
}
if field.Type != FmpFieldSimple {
t.Errorf("expected field type to be simple, but it is not")
}
if field.DataType != FmpDataText {
t.Errorf("expected field data type to be text, but it is not")
}
if field.StorageType != FmpFieldStorageRegular {
t.Errorf("expected field storage type to be regular, but it is not")
}
if !field.Indexed {
t.Errorf("expected field to be indexed, but it is not")
}
if field.AutoEnter != FmpAutoEnterCalculationReplacingExistingValue {
t.Errorf("expected field to have auto enter calculation replacing existing value, but it does not")
}
}