Documentation ¶
Overview ¶
Package deta is the core Deta SDK package.
Configuring credentials ¶
You will require you project key when using the Deta SDK.
By default, the SDK looks for the environment variable DETA_PROJECT_KEY for the project key.
// Create a new Deta instance taking the project key from the environment by default d, err := deta.New() if err != nil { fmt.Fprintf(os.Stderr, "failed to create new deta instance: %v\n", err) }
You can use the WithProjectKey option when creating a Deta instance to provide the project key explicitly.
// Create a new Deta instance with explicit project key d, err := deta.New(deta.WithProjectKey("project_key")) if err != nil { fmt.Fprintf(os.Stderr, "failed to create new deta instance: %v\n", err) }
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrBadProjectKey bad project key ErrBadProjectKey = errors.New("bad project key") // ErrBadRequest bad request ErrBadRequest = errors.New("bad request") ErrUnauthorized = errors.New("unauthorized") // ErrNotFound not found ErrNotFound = errors.New("not found") // ErrConflict conflict ErrConflict = errors.New("conflict") // ErrInternalServerError internal server error ErrInternalServerError = errors.New("internal server error") // ErrEmptyDetaInstance empty deta instance ErrEmptyDetaInstance = errors.New("empty deta instance") // ErrBadBaseName bad base name ErrBadBaseName = errors.New("bad base name") // ErrTooManyItems too many items ErrTooManyItems = errors.New("too many items") // ErrBadDestination bad destination ErrBadDestination = errors.New("bad destination") // ErrBadItem bad item/items ErrBadItem = errors.New("bad item/items") // ErrBadDriveName bad drive name ErrBadDriveName = errors.New("bad drive name") // ErrEmptyName empty name ErrEmptyName = errors.New("name is empty") // ErrEmptyNames empty names ErrEmptyNames = errors.New("names is empty") // ErrTooManyNames too many names ErrTooManyNames = errors.New("too many names") // ErrEmptyData no data ErrEmptyData = errors.New("no data provided") )
Functions ¶
This section is empty.
Types ¶
type ConfigOption ¶
type ConfigOption func(*Deta)
ConfigOption is a functional config option for Deta
func WithProjectKey ¶
func WithProjectKey(projectKey string) ConfigOption
WithProjectKey config option for setting the project key for Deta
Click to show internal directories.
Click to hide internal directories.