primaryTableCreate creates a query for table creation based on the specified TableSchema. Returns the query if successful. Returns an error if there is an invalid column type.
(name string, schema TableSchema)
| 291 | // specified TableSchema. Returns the query if successful. Returns an error |
| 292 | // if there is an invalid column type. |
| 293 | func (store *sqlOfflineStore) createsqlPrimaryTableQuery(name string, schema TableSchema) (string, error) { |
| 294 | columns := make([]string, 0) |
| 295 | for _, column := range schema.Columns { |
| 296 | columnType, err := store.query.determineColumnType(column.ValueType) |
| 297 | if err != nil { |
| 298 | return "", err |
| 299 | } |
| 300 | columns = append(columns, fmt.Sprintf("%s %s", column.Name, columnType)) |
| 301 | } |
| 302 | columnString := strings.Join(columns, ", ") |
| 303 | return store.query.primaryTableCreate(name, columnString), nil |
| 304 | } |
| 305 | |
| 306 | func (store *sqlOfflineStore) GetPrimaryTable(id ResourceID) (PrimaryTable, error) { |
| 307 | name, err := GetPrimaryTableName(id) |
no test coverage detected