(info CreateInfo)
| 70 | return &db |
| 71 | } |
| 72 | func (r *Remote) Create(info CreateInfo) error { |
| 73 | createSql := fmt.Sprintf("CREATE DATABASE \"%s\"", info.Name) |
| 74 | if err := r.ExecSQL(createSql, info.Timeout); err != nil { |
| 75 | if strings.Contains(strings.ToLower(err.Error()), "already exists") { |
| 76 | return buserr.New("ErrDatabaseIsExist") |
| 77 | } |
| 78 | return err |
| 79 | } |
| 80 | if err := r.CreateUser(info, true); err != nil { |
| 81 | return err |
| 82 | } |
| 83 | return nil |
| 84 | } |
| 85 | |
| 86 | func (r *Remote) CreateUser(info CreateInfo, withDeleteDB bool) error { |
| 87 | createSql := fmt.Sprintf("CREATE USER \"%s\" WITH PASSWORD '%s'", info.Username, info.Password) |
nothing calls this directly
no test coverage detected