GetClientByToken returns the client for the given token or nil.
(token string)
| 22 | |
| 23 | // GetClientByToken returns the client for the given token or nil. |
| 24 | func (d *GormDatabase) GetClientByToken(token string) (*model.Client, error) { |
| 25 | client := new(model.Client) |
| 26 | err := d.DB.Where("token = ?", token).Find(client).Error |
| 27 | if err == gorm.ErrRecordNotFound { |
| 28 | err = nil |
| 29 | } |
| 30 | if client.Token == token { |
| 31 | return client, err |
| 32 | } |
| 33 | return nil, err |
| 34 | } |
| 35 | |
| 36 | // CreateClient creates a client. |
| 37 | func (d *GormDatabase) CreateClient(client *model.Client) error { |
nothing calls this directly
no outgoing calls
no test coverage detected