Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make insert functions work 100% correctly for complex types #17

Open
trzysiek opened this issue Feb 16, 2024 · 0 comments
Open

Make insert functions work 100% correctly for complex types #17

trzysiek opened this issue Feb 16, 2024 · 0 comments

Comments

@trzysiek
Copy link
Member

trzysiek commented Feb 16, 2024

Probably very low priority.

Right now the test below doesn't pass, as we don't handle complex types like Arrays of Tuples 100% correctly.
Same thing probably applies to a couple other functions which have very similar structure, it'd be good to check them as well.

func TestRemoveNonSchemaFields_Arrays(t *testing.T) {
	insertQueryMap := SchemaMap{
		"array": []interface{}{
			SchemaMap{
				"a": "avalue",
				"c": "cvalue",
			},
		},
	}
	table := &Table{
		Cols: map[string]*Column{
			"array": {
				Name: "array",
				Type: CompoundType{
					Name: "Array", BaseType: MultiValueType{
						Name: "Tuple",
						Cols: []*Column{
							{
								Name: "a",
								Type: NewBaseType("String"),
							},
							{
								Name: "b",
								Type: NewBaseType("String"),
							},
						},
					},
				},
			},
		},
	}

	afterRemovalMap := RemoveNonSchemaFields(insertQueryMap, table)
	pp.Println(afterRemovalMap)
	_, ok := afterRemovalMap["array"].([]interface{})[0].(SchemaMap)["c"]
	assert.False(t, ok)
}
@trzysiek trzysiek changed the title Make insert methods work 100% correctly for complex types Make insert functions work 100% correctly for complex types Feb 16, 2024
@pivovarit pivovarit transferred this issue from another repository May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant