// GetEntries : return the password entries in the Enpass database.
GetEntries : return the password entries in the Enpass database.
// GetEntries : return the password entries in the Enpass database .
func (v *Vault) GetEntries(cardType string, filters []string) ([]Card, error) {
	if v.db == nil || v.vaultInfo.VaultName == "" {
		return nil, errors.New("vault is not initialized")
	}
	rows, err := v.db.Query(`
		SELECT uuid, type, created_at, field_updated_at, title,
		       subtitle, note, trashed, item.deleted, category,
		       label, value, key, last_used
		FROM item
		INNER JOIN itemfield ON uuid = item_uuid
	`)
	if err != nil {
		return nil, errors.Wrap(err, "could not retrieve cards from database")
	}
	var cards []Card
	for rows.Next() {
		var card Card
		if err := rows.Scan(
			&card.UUID, &card.Type, &card.CreatedAt, &card.UpdatedAt, &card.Title,
			&card.Subtitle, &card.Note, &card.Trashed, &card.Deleted, &card.Category,
			&card.Label, &card.value, &card.itemKey, &card.LastUsed,
		); err != nil {
			return nil, errors.Wrap(err, "could not read card from database")
		}
		if card.IsDeleted() {
			continue
		}
		if cardType != "" && card.Type != cardType {
			continue
		}
		if len(filters) > 0 {
			found := false
			for _, filter := range filters {
				if strings.Contains(strings.ToLower(card.Title), strings.ToLower(filter)) {
					found = true
					break
				}
			}
			if !found {
				continue
			}
		}
		cards = append(cards, card)
	}
	return cards, nil
}
func ( v * Vault ) GetEntries ( cardType string , filters [ ] string ) ( [ ] Card , error ) { if v . db == nil || v . vaultInfo . VaultName == " " { return nil , errors . New ( " " ) } rows , err := v . db . Query ( `
		SELECT uuid, type, created_at, field_updated_at, title,
		       subtitle, note, trashed, item.deleted, category,
		       label, value, key, last_used
		FROM item
		INNER JOIN itemfield ON uuid = item_uuid
	` ) if err != nil { return nil , errors . Wrap ( err , " " ) } var cards [ ] Card for rows . Next ( ) { var card Card if err := rows . Scan ( & card . UUID , & card . Type , & card . CreatedAt , & card . UpdatedAt , & card . Title , & card . Subtitle , & card . Note , & card . Trashed , & card . Deleted , & card . Category , & card . Label , & card . value , & card . itemKey , & card . LastUsed , ) ; err != nil { return nil , errors . Wrap ( err , " " ) } if card . IsDeleted ( ) { continue } if cardType != " " && card . Type != cardType { continue } if len ( filters ) > 0 { found := false for _ , filter := range filters { if strings . Contains ( strings . ToLower ( card . Title ) , strings . ToLower ( filter ) ) { found = true break } } if ! found { continue } } cards = append ( cards , card ) } return cards , nil }
GetEntries : return the password entries in the Enpass database.
GetEntries : return the password entries in the Enpass database .
// read the database columns into Card object // if item has been deleted // if we specify a type filter // check any supplied title filters