go get github.com/ashish111333/minds-go-sdk
-
Initialize the client
Intialize the client with your api key to interact with the sdk.
import "github.com/ashish111333/minds-go-sdk/client" func main(){ client,err:=client.NewClient("YOUR_API_KEY) if err!=nil{ fmt.println("failed to create client",err) } }
-
Creating a Datasource
You can connect to various databases, such as PostgreSQL, by configuring your data source. Use the DatabaseConfig to define the connection details for your data source.
import "github.com/ashish111333/minds-go-sdk/datasources" func main(){ postgresConfig:=datasources.Datasource{ DatabaseConfig:{ name='my_datasource', description='<DESCRIPTION-OF-YOUR-DATA>', engine='postgres', connection_data={ "user": 'demo_user', "password": "demo_password", "host": "samples.mindsdb.com", "port": 5432, "database": 'demo', "schema": 'demo_data' }, tables=['<TABLE-1>', '<TABLE-2>'] } } }
-
Creating a mind
You can create a mind and associate it with a data source.
You can create a mind or replace an existing one with the same name.
get list of minds you created
minds,err:=client.minds.list()
you can fetch details of a mind by its name.
mind,err:=client.minds.get("mind_name")
you can remove a mind given it's name using drop method
err=client.minds.drop("mind_name")
To view all data sources:
To delete a data source, use the following command:
err=client.Datasources.remove("Datasource_name")
You can fetch details of a specific data source by its name.
ds,err=client.Datasources.Get("Datasource_name")