github.com/weaviate/weaviate@v1.24.6/test/acceptance/schema/helper.go (about)

     1  //                           _       _
     2  // __      _____  __ ___   ___  __ _| |_ ___
     3  // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
     4  //  \ V  V /  __/ (_| |\ V /| | (_| | ||  __/
     5  //   \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
     6  //
     7  //  Copyright © 2016 - 2024 Weaviate B.V. All rights reserved.
     8  //
     9  //  CONTACT: hello@weaviate.io
    10  //
    11  
    12  package test
    13  
    14  import (
    15  	"testing"
    16  
    17  	"github.com/weaviate/weaviate/test/helper"
    18  )
    19  
    20  // Helper function to get all the names of Object classes.
    21  func GetObjectClassNames(t *testing.T) []string {
    22  	resp, err := helper.Client(t).Schema.SchemaDump(nil, nil)
    23  	var names []string
    24  
    25  	// Extract all names
    26  	helper.AssertRequestOk(t, resp, err, func() {
    27  		for _, class := range resp.Payload.Classes {
    28  			names = append(names, class.Class)
    29  		}
    30  	})
    31  
    32  	return names
    33  }
    34  
    35  // Helper function to get all the names of Action classes.
    36  // func GetActionClassNames(t *testing.T) []string {
    37  // 	resp, err := helper.Client(t).Schema.SchemaDump(nil, nil)
    38  // 	var names []string
    39  
    40  // 	// Extract all names
    41  // 	helper.AssertRequestOk(t, resp, err, func() {
    42  // 		for _, class := range resp.Payload.Actions.Classes {
    43  // 			names = append(names, class.Class)
    44  // 		}
    45  // 	})
    46  
    47  // 	return names
    48  // }