code: func (db *Database) Listen(channel string, f func(payload ...string)) error {
  	// Create a new listener only if Listen is called for the first time
  	if db.listener == nil {
  		db.listenerCallbacks = make(map[string]func(...string))
  
  		reportProblem := func(ev pq.ListenerEventType, err error) {
  			if err != nil && db.logger != nil {
  				db.printLog(err.Error())
  			}
  		}
  		db.listener = pq.NewListener(db.connectionString, 10*time.Second, time.Minute, reportProblem)
  
  		if db.listener == nil {
  			return errors.New("Unable to create a new listener")
  		}
  
  		// detach event handler
  		go func() {
  			for {
  				select {
  				case notification := <-db.listener.Notify:
  					go db.listenerCallbacks[notification.Channel](notification.Extra)
  				case <-time.After(90 * time.Second):
  					go func() {
  						if db.listener.Ping() != nil {
  							db.printLog(fmt.Sprintf("Error checking server connection for channel %s\n", channel))
  							return
  						}
  					}()
  				}
  			}
  		}()
  	}
  
  	if _, alreadyIn := db.listenerCallbacks[channel]; alreadyIn {
  		return errors.New("Already subscribed to channel " + channel)
  	}
  
  	db.listenerCallbacks[channel] = f
  
  	if err := db.listener.Listen(channel); err != nil {
  		return err
  	}
  
  	return nil
  }
docs: // Listen executes `LISTEN channel`. Uses f to handle received notifications on chanel.
  // On error logs error messages (if a logs exists)