Compare commits
3 commits
dfd3bb5f48
...
541d0fce27
| Author | SHA1 | Date | |
|---|---|---|---|
| 541d0fce27 | |||
| 4102aa20d2 | |||
| 103a872be2 |
1 changed files with 7 additions and 1 deletions
|
|
@ -71,7 +71,10 @@ func sqlDate2oapi(p_date pgtype.Timestamptz) *time.Time {
|
|||
|
||||
func oapiDate2sql(t *time.Time) pgtype.Timestamptz {
|
||||
if t == nil {
|
||||
return pgtype.Timestamptz{Valid: false}
|
||||
return pgtype.Timestamptz{
|
||||
Time: time.Now(),
|
||||
Valid: true,
|
||||
}
|
||||
}
|
||||
return pgtype.Timestamptz{
|
||||
Time: *t,
|
||||
|
|
@ -386,6 +389,9 @@ func (s Server) AddUserTitle(ctx context.Context, request oapi.AddUserTitleReque
|
|||
// fmt.Println(pgErr.Code) // => 42601
|
||||
if pgErr.Code == pgErrDuplicateKey { //duplicate key value
|
||||
return oapi.AddUserTitle409Response{}, nil
|
||||
} else {
|
||||
log.Errorf("%v", err)
|
||||
return oapi.AddUserTitle500Response{}, nil
|
||||
}
|
||||
} else {
|
||||
log.Errorf("%v", err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue