select pid, query from pg_stat_activity where state='active';
select pg_cancel_backend();
const ( | |
// When reconnecting to the server after connection failure | |
reconnectDelay = 5 * time.Second | |
) | |
// Client holds necessery information for rabbitMQ | |
type Client struct { | |
pushQueue string | |
logger zerolog.Logger | |
connection *amqp.Connection |
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
// Simpler version for Or | |
func OrVer2(ch ...chan struct{}) <-chan struct{} { | |
switch len(ch) { |
package main | |
import ( | |
"fmt" | |
"runtime" | |
"sync" | |
) | |
func main() { | |
// can be a input stream such as CSV/Network/File. |
package main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
"net/http/pprof" | |
) | |
// HTTP request handler | |
func handler(w http.ResponseWriter, r *http.Request) { |
// https://play.golang.org/p/7oTksbq9ioW | |
package main | |
import ( | |
"fmt" | |
) | |
func main() { |
ERROR: cannot refresh materialized view "public.mvw_prod" concurrently
HINT: Create a unique index with no WHERE clause on one or more columns of the materialized view.
create materialized view mvw_prod as select productid, productname, supplierid from products join categories using(categoryid) where productid>5;
import 'dart:async'; | |
Future<void> printOrderMessage() async { | |
print('printOrderMessage: Awaiting user order... fetches and returns Future<void>'); | |
var order = await fetchUserOrder(); | |
print('This and following execute only after Future is complete'); | |
print('Your order is: $order'); | |
} | |
Future<String> fetchUserOrder() { |
package collections | |
type Item[T any] struct { | |
Item T | |
Priority int | |
Index int | |
} | |
type PriorityQueue[T any] []*Item[T] |