code: func (ss *SQLSubStore) DeleteSub(subid uint64) error {
  	ss.Lock()
  	defer ss.Unlock()
  	if subid == atomic.LoadUint64(ss.maxSubID) {
  		if _, err := ss.sqlStore.preparedStmts[sqlMarkSubscriptionAsDeleted].Exec(ss.channelID, subid); err != nil {
  			return sqlStmtError(sqlMarkSubscriptionAsDeleted, err)
  		}
  		ss.hasMarkedAsDel = true
  	} else {
  		if _, err := ss.sqlStore.preparedStmts[sqlDeleteSubscription].Exec(ss.channelID, subid); err != nil {
  			return sqlStmtError(sqlDeleteSubscription, err)
  		}
  	}
  	if ss.cache != nil {
  		delete(ss.cache.subs, subid)
  	} else {
  		delete(ss.subLastSent, subid)
  	}
  	// Ignore error on this since subscription would not be recovered
  	// if above executed ok.
  	ss.sqlStore.preparedStmts[sqlDeleteSubPendingMessages].Exec(subid)
  	return nil
  }
docs: // DeleteSub implements the SubStore interface