encryptAIProviderSettings encrypts the settings column in place, updating settings_key_id as a side effect. A NULL or blank settings value clears any associated key reference.
(settings *sql.NullString, keyID *sql.NullString)
| 402 | // updating settings_key_id as a side effect. A NULL or blank settings |
| 403 | // value clears any associated key reference. |
| 404 | func (db *dbCrypt) encryptAIProviderSettings(settings *sql.NullString, keyID *sql.NullString) error { |
| 405 | if !settings.Valid || strings.TrimSpace(settings.String) == "" { |
| 406 | *settings = sql.NullString{} |
| 407 | *keyID = sql.NullString{} |
| 408 | return nil |
| 409 | } |
| 410 | return db.encryptField(&settings.String, keyID) |
| 411 | } |
| 412 | |
| 413 | func (db *dbCrypt) GetAIProviderByID(ctx context.Context, id uuid.UUID) (database.AIProvider, error) { |
| 414 | provider, err := db.Store.GetAIProviderByID(ctx, id) |
no test coverage detected