weave

package module
v0.0.0-...-eb14db3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2025 License: MIT Imports: 16 Imported by: 0

README

weave

A generator that creates weaviate schema and crud tools from Golang structs

Documentation

Index

Constants

View Source
const (
	// WeaviatePackage is the package name for the Weaviate client
	WeaviatePackage = "github.com/weaviate/weaviate-go-client/v5"
)

Variables

This section is empty.

Functions

func GenerateCRUDCode

func GenerateCRUDCode(schema *WeaviateSchemaDefinition, outputDir string) (string, error)

GenerateCRUDCode generates CRUD implementation for all Weaviate classes returns the generated package name

func GenerateTypes

func GenerateTypes(packageName string, outputDir string) error

Types

type TemplateData

type TemplateData[T any] struct {
	AutogeneratedNotice string
	WeaviatePackage     string
	PackageName         string
	Data                T
}

type WeaviateClass

type WeaviateClass struct {
	Package             string                 `json:"-"`
	Class               string                 `json:"class"`
	Description         string                 `json:"description,omitempty"`
	VectorIndexType     string                 `json:"vectorIndexType,omitempty"`
	VectorIndexConfig   map[string]interface{} `json:"vectorIndexConfig,omitempty"`
	Properties          []WeaviateProperty     `json:"properties"`
	Vectorizer          string                 `json:"vectorizer,omitempty"`
	ModuleConfig        map[string]interface{} `json:"moduleConfig,omitempty"`
	ShardingConfig      map[string]interface{} `json:"shardingConfig,omitempty"`
	ReplicationConfig   map[string]interface{} `json:"replicationConfig,omitempty"`
	InvertedIndexConfig map[string]interface{} `json:"invertedIndexConfig,omitempty"`
}

WeaviateClass represents a Weaviate class schema definition

type WeaviateProperty

type WeaviateProperty struct {
	Name            string   `json:"name"`
	DataType        []string `json:"dataType"`
	Description     string   `json:"description,omitempty"`
	Tokenization    string   `json:"tokenization,omitempty"`
	IndexFilterable bool     `json:"indexFilterable,omitempty"`
	IndexSearchable bool     `json:"indexSearchable,omitempty"`
	IndexInverted   bool     `json:"indexInverted,omitempty"`
}

WeaviateProperty represents a property in a Weaviate class

type WeaviateSchemaDefinition

type WeaviateSchemaDefinition struct {
	Classes []WeaviateClass `json:"classes"`
}

WeaviateSchemaDefinition represents the entire schema

func GenerateWeaviateSchema

func GenerateWeaviateSchema(srcDir string) (*WeaviateSchemaDefinition, error)

GenerateWeaviateSchema processes Go source files and generates Weaviate schema

func (*WeaviateSchemaDefinition) ToJSON

func (s *WeaviateSchemaDefinition) ToJSON(pretty bool) ([]byte, error)

ToJSON converts the schema to a JSON string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL