-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.go
36 lines (31 loc) · 980 Bytes
/
schema.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package harper
// Low-level operations
// CreateSchema creates a new schema.
// Returns "AlreadyExistsError" if schema already existed.
func (c *Client) CreateSchema(schema string) error {
return c.opRequest(operation{
Operation: OP_CREATE_SCHEMA,
Schema: schema,
}, nil)
}
// DropSchema drops a schema.
// Returns "DoesNotExistError" if schema did not exist.
func (c *Client) DropSchema(schema string) error {
return c.opRequest(operation{
Operation: OP_DROP_SCHEMA,
Schema: schema,
}, nil)
}
// DescribeSchemaResponse is a temporary type until it is defined more accurately.
type DescribeSchemaResponse map[string]interface{}
// DescribeSchema returns metadata about a schema.
func (c *Client) DescribeSchema(schema string) (DescribeSchemaResponse, error) {
var schemaData DescribeSchemaResponse
err := c.opRequest(OpDescribeSchema{
Schema: schema,
}, &schemaData)
if err != nil {
return DescribeSchemaResponse{}, err
}
return schemaData, nil
}