This is a implementation of dim, which is built in python. But this time in go.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
623 B

package main
import (
// Creates a new DNS zone.
func zoneCreate(c *Context, req Request, res *Response) error {
zoneName := new(types.ZoneName)
if err := req.Parse(&zoneName); err != nil {
res.AddMessage(LevelError, "expected zone name, but got error: %s", err)
return nil
id := 0
err := c.tx.
QueryRow(`insert into zones(name, created_by, modified_by)
values ($1, $2, $2) returning id`, zoneName, c.username).
if err != nil {
res.AddMessage(LevelError, "could not create zone")
return fmt.Errorf("could not create zone '%s': %s", zoneName, err)
return nil