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.

28 lines
778 B

package main
import (
type (
Layer3DomainCreateOptions string
// Layer3DomainCreate creates a new layer3domain.
func layer3DomainCreate(c *Context, req Request, res *Response) error {
name := ""
options := Layer3DomainCreateOptions("{}")
if err := req.ParseAtLeast(1, &name, &options); err != nil {
res.AddMessage(LevelError, "could not parse parameter: %s", err)
return nil
_, err := c.tx.Exec(`insert into layer3domains(name, attributes, created_by, modified_by)
values ($1, $2::jsonb, $3, $3)`, name, options, c.username)
// TODO handle unique constraint violation
if err != nil {
res.AddMessage(LevelError, "could not create layer3domain '%s'", name)
return fmt.Errorf("could not insert layer3domain '%s': %s", name, err)
return nil