package discord import ( dsmodel "dorisbot/database/models/discord" sq "github.com/elgris/sqrl" ) // ServerImpl - type ServerImpl struct{} // Create - func (s ServerImpl) Create(server *dsmodel.Server) error { query, args, err := sq.Insert(`"discord"."server"`).Columns("id", "name", "permission", "owner"). Values(server.ID, server.Name, server.Permission, server.Owner). Suffix("returning *"). ToSql() if err != nil { return err } query = x.Rebind(query) err = x.Get(server, query, args...) if err != nil { return err } return nil } // Delete - func (s ServerImpl) Delete(id string) error { query, args, err := sq.Delete(`"discord"."server"`).Where(sq.Eq{"id": id}).ToSql() if err != nil { return err } query = x.Rebind(query) _, err = x.Exec(query, args...) if err != nil { return err } return nil }