lxd/db/config.go
func ConfigValueSet(c *Cluster, key string, value string) error {
	err := c.Transaction(func(tx *ClusterTx) error {
		_, err := tx.tx.Exec("DELETE FROM config WHERE key=?", key)
		if err != nil {
			return err
		}

		if value != "" {
			str := `INSERT INTO config (key, value) VALUES (?, ?);`
			stmt, err := tx.tx.Prepare(str)
			if err != nil {
				return err
			}
			defer stmt.Close()
			_, err = stmt.Exec(key, value)
			if err != nil {
				return err
			}
		}
		return nil
	})
	return err
}
func ConfigValueSet(c *Cluster, key string, value string) error {
	err := c.Transaction(func(tx *ClusterTx) error {
		_, err := tx.tx.Exec("DELETE FROM config WHERE key=?", key)
		if err != nil {
			return err
		}

		if value != "" {
			str := `INSERT INTO config (key, value) VALUES (?, ?);`
			stmt, err := tx.tx.Prepare(str)
			if err != nil {
				return err
			}
			defer stmt.Close()
			_, err = stmt.Exec(key, value)
			if err != nil {
				return err
			}
		}
		return nil
	})
	return err
}
func ConfigValueSet ( c * Cluster , key string , value string ) error { err := c . Transaction ( func ( tx * ClusterTx ) error { _ , err := tx . tx . Exec ( " " , key ) if err != nil { return err } if value != " " { str := `INSERT INTO config (key, value) VALUES (?, ?);` stmt , err := tx . tx . Prepare ( str ) if err != nil { return err } defer stmt . Close ( ) _ , err = stmt . Exec ( key , value ) if err != nil { return err } } return nil } ) return err }
// ConfigValueSet is a convenience to set a cluster-level key/value config pair
// in a single transaction.
ConfigValueSet is a convenience to set a cluster - level key / value config pair in a single transaction .