From 3f985fe6c0d32b3866851243aea56ecd494e11bc Mon Sep 17 00:00:00 2001 From: Grzegorz Piwowarek Date: Tue, 4 Jun 2024 15:33:30 +0200 Subject: [PATCH] Remove unused JsonToTableSchema() (#268) --- quesma/clickhouse/parser.go | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/quesma/clickhouse/parser.go b/quesma/clickhouse/parser.go index 0f8f65989..8cfc46454 100644 --- a/quesma/clickhouse/parser.go +++ b/quesma/clickhouse/parser.go @@ -2,7 +2,6 @@ package clickhouse import ( "fmt" - "mitmproxy/quesma/quesma/types" "mitmproxy/quesma/util" "slices" "strings" @@ -10,35 +9,6 @@ import ( const NestedSeparator = "::" -func JsonToTableSchema(jsonn, tableName string, config *ChTableConfig) (*Table, error) { - m, err := types.ParseJSON(jsonn) - if err != nil { - return nil, err - } - - cols := make(map[string]*Column) - for name, value := range m { - // TODO make fields private and add constructor? - cols[name] = &Column{Name: name, Type: NewType(value), Codec: Codec{Name: ""}} // TODO codec not supported - } - - // add others - if _, ok := cols[othersFieldName]; config.hasOthers && !ok { - cols[othersFieldName] = &Column{Name: othersFieldName, Type: NewType(SchemaMap{}), Codec: Codec{Name: ""}} // TODO codec not supported - } - // add attributes - for _, a := range config.attributes { - if _, ok := cols[a.KeysArrayName]; !ok { - cols[a.KeysArrayName] = &Column{Name: a.KeysArrayName, Type: NewType(""), Codec: Codec{Name: ""}} // TODO codec not supported - } - if _, ok := cols[a.ValuesArrayName]; !ok { - cols[a.ValuesArrayName] = &Column{Name: a.ValuesArrayName, Type: a.Type, Codec: Codec{Name: ""}} // TODO codec not supported - } - } - - return &Table{Name: tableName, Config: config, Cols: cols}, nil -} - // m: unmarshalled json from HTTP request // Returns nicely formatted string for CREATE TABLE command func FieldsMapToCreateTableString(namespace string, m SchemaMap, indentLvl int, config *ChTableConfig) string {