automatically fill empty public ids for view types

Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
This commit is contained in:
Dmitri Dolguikh
2026-08-03 11:34:22 +02:00
parent 206bb1676b
commit 9653b15d78
2 changed files with 22 additions and 0 deletions
@@ -116,6 +116,14 @@ func TestWithMultipleFields(t *testing.T) {
}, dst)
}
func TestEmptyPublicIdsFilled(t *testing.T) {
src := withEmptyPublicIds{}
dst := emptyPublicIdTarget{}
assert.NoError(t, networkmapdb.FromSqlTypesToSharedTypes(reflect.ValueOf(&src), reflect.ValueOf(&dst)))
assert.NotEmpty(t, dst.PublicID)
assert.NotEmpty(t, dst.PublicId)
}
type withNullString struct {
Name sql.NullString
}
@@ -199,3 +207,13 @@ type nullableTimePointerTarget struct {
type withStringSlice struct {
Field []string
}
type withEmptyPublicIds struct {
PublicID sql.NullString
PublicId sql.NullString
}
type emptyPublicIdTarget struct {
PublicID string
PublicId string
}