func (d UserPassphrase) PassphraseQuery(db *database.Database) string {
	passphraseInvalidation := NewUserPassphraseInvalidation()
	var query string
	switch db.Type {
	case model.Postgres:
		query = "SELECT p.* FROM " + d.TableName() + " AS p " +
			"LEFT OUTER JOIN " + passphraseInvalidation.TableName() + " AS pi ON p.id = pi.passphrase_id " +
			"WHERE pi.passphrase_id IS NULL AND p.passphrase = $1 AND " +
			"p.inserted_at >= (now() - interval '3 month')"
		break
	}
	return query
}
PassphraseQuery generate user_passphrase query string for database type
package model
import (
	"github.com/streetbyters/agente/database"
	"github.com/streetbyters/agente/model"
	"github.com/streetbyters/agente/utils"
	"time"
)
type UserPassphrase struct {
	database.DBInterface `json:"-"`
	ID                   int64     `db:"id" json:"id"`
	NodeID               int64     `db:"node_id" json:"node_id" foreign:"fk_ra_user_passphrases_node_id" validate:"required"`
	UserID               int64     `db:"user_id" json:"user_id" foreign:"fk_ra_user_passphrases_user_id"`
	Passphrase           string    `db:"passphrase" json:"passphrase" unique:"ra_user_passphrases_passphrase_unique_index"`
	InsertedAt           time.Time `db:"inserted_at" json:"inserted_at"`
}
func NewUserPassphrase(userID int64) *UserPassphrase {
	return &UserPassphrase{
		UserID:     userID,
		Passphrase: utils.Passkey(),
	}
}
func (d UserPassphrase) TableName() string {
	return "ra_user_passphrases"
}
func (d UserPassphrase) ToJSON() string {
	return database.ToJSON(d)
}