package dao

import "gorm.io/gorm"

type Password struct {
	gorm.Model
	Password string `gorm:"column:password" json:"password"`
}

func (m *Password) TableName() string {
	return "key_manager_password"
}

func (dao *Dao) CreatePassword(data *Password) error {
	return dao.db.Create(&data).Error
}
func (dao *Dao) GetPassword() (string, error) {
	var p Password
	err := dao.db.Table(new(Password).TableName()).First(&p).Error
	return p.Password, err
}
