code: func (s *Store) database(leader bool, dst io.Writer) error {
  	if leader && s.raft.State() != raft.Leader {
  		return ErrNotLeader
  	}
  
  	f, err := ioutil.TempFile("", "rqlilte-snap-")
  	if err != nil {
  		return err
  	}
  	if err := f.Close(); err != nil {
  		return err
  	}
  	os.Remove(f.Name())
  	db, err := sdb.New(f.Name(), "", false)
  	if err != nil {
  		return err
  	}
  	conn, err := db.Connect()
  	if err != nil {
  		return err
  	}
  
  	if err := s.dbConn.Backup(conn); err != nil {
  		return err
  	}
  	if err := conn.Close(); err != nil {
  		return err
  	}
  
  	of, err := os.Open(f.Name())
  	if err != nil {
  		return err
  	}
  	defer of.Close()
  
  	_, err = io.Copy(dst, of)
  	return err
  }
docs: // Database copies contents of the underlying SQLite file to dst