1 package common 2 3 import ( 4 "context" 5 "database/sql" 6 ) 7 8 const ( 9 GetActivationCode = "SELECT activation_code FROM terminals WHERE terminal_id = $1;" 10 ) 11 12 // FetchActivationCode returns the activation code for the terminal from the provided database 13 func FetchActivationCode(ctx context.Context, sqlDB *sql.DB, terminalID string) (*string, error) { 14 row := sqlDB.QueryRowContext(ctx, GetActivationCode, terminalID) 15 var ac *string 16 err := row.Scan(&ac) 17 return ac, err 18 } 19