func (s SettingsOp) GetSettingsOptions() []types.SettingsOption {
	const query = "SELECT * FROM settings_option ORDER BY id ASC"
	db, _ := ConnectDB()
	options := []types.SettingsOption{}
	err := db.Select(&options, query)
	if err != nil {
		log.Error(err)
	}
	db.Close()
	return options
}
GetSettingsOptions Gets all available setting options.
package data
import (
	"encoding/hex"
	"fmt"
	"github.com/alfg/openencoder/api/config"
	"github.com/alfg/openencoder/api/helpers"
	"github.com/alfg/openencoder/api/types"
)
type Settings interface {
	GetSetting(key string) (*types.Setting, error)
	GetSettings() []types.Setting
	GetSettingsOptions() []types.SettingsOption
	CreateSetting(setting types.Setting) *types.Setting
	CreateOrUpdateSetting(key, value string)
	UpdateSettings(setting map[string]string) error
	UpdateSetting(setting types.Setting) *types.Setting
	SettingExists(optionID int64) bool
}
type SettingsOp struct {
	s *Settings
}
var _ Settings = &SettingsOp{}
func (s SettingsOp) GetSetting(key string) (*types.Setting, error) {
	const query = `
	  SELECT
        settings.*,
        settings_option.id "settings_option.id",
        settings_option.name "settings_option.name",
        settings_option.title "settings_option.title",
        settings_option.description "settings_option.description",
        settings_option.secure "settings_option.secure"
	  FROM settings
      JOIN settings_option ON settings.settings_option_id = settings_option.id
      WHERE settings_option.name = $1
      ORDER BY id DESC`
	db, _ := ConnectDB()
	setting := types.Setting{}
	err := db.Get(&setting, query, key)
	if err != nil {
		log.Error(err)
		return nil, err
	}
	db.Close()
	if setting.Secure {
		enc, _ := hex.DecodeString(setting.Value)
		plaintext, _ := helpers.Decrypt(enc, config.Keyseed())
		setting.Value = string(plaintext)
	}
	return &setting, nil
}
func (s SettingsOp) GetSettings() []types.Setting {
	const query = `
	  SELECT
        settings.*,
        settings_option.id "settings_option.id",
        settings_option.name "settings_option.name",
        settings_option.title "settings_option.title",
        settings_option.description "settings_option.description",
        settings_option.secure "settings_option.secure"
	  FROM settings
      JOIN settings_option ON settings.settings_option_id = settings_option.id
      ORDER BY id DESC`
	db, _ := ConnectDB()
	settings := []types.Setting{}
	err := db.Select(&settings, query)
	if err != nil {
		log.Error(err)
	}
	db.Close()
	for i := range settings {
		if settings[i].Secure {
			enc, _ := hex.DecodeString(settings[i].Value)
			plaintext, _ := helpers.Decrypt(enc, config.Keyseed())
			settings[i].Value = string(plaintext)
		}
	}
	return settings
}