func ListApiKeys(db *sql.DB) error {
	result, err := db.Query("SELECT apiKey, createdDate, lastUsed, createMsg FROM api_keys ORDER BY createdDate ASC")
	if err != nil {
		return fmt.Errorf("failed to list api keys from db: %s", err)
	}
	defer result.Close()

	fmt.Printf("%-44s  %-25s  %-25s  %s\n", "API Key", "Created On", "Last Used", "Message")
	for result.Next() {
		var apiKey string
		var createdDate string
		var lastUsedNull sql.NullString
		var lastUsed string
		var createMsg string
		result.Scan(&apiKey, &createdDate, &lastUsedNull, &createMsg)
		if lastUsedNull.Valid {
			lastUsed = lastUsedNull.String
		} else {
			lastUsed = "Never Used"
		}
		fmt.Printf("%-44s  %-25s  %-25s  %s\n", apiKey, createdDate, lastUsed, createMsg)
	}

	return nil
}
// ListApiKeys lists all keys in the keys table
ListApiKeys lists all keys in the keys table
// ListApiKeys lists all keys in the keys table
func ListApiKeys(db *sql.DB) error {
	result, err := db.Query("SELECT apiKey, createdDate, lastUsed, createMsg FROM api_keys ORDER BY createdDate ASC")
	if err != nil {
		return fmt.Errorf("failed to list api keys from db: %s", err)
	}
	defer result.Close()
	fmt.Printf("%-44s  %-25s  %-25s  %s\n", "API Key", "Created On", "Last Used", "Message")
	for result.Next() {
		var apiKey string
		var createdDate string
		var lastUsedNull sql.NullString
		var lastUsed string
		var createMsg string
		result.Scan(&apiKey, &createdDate, &lastUsedNull, &createMsg)
		if lastUsedNull.Valid {
			lastUsed = lastUsedNull.String
		} else {
			lastUsed = "Never Used"
		}
		fmt.Printf("%-44s  %-25s  %-25s  %s\n", apiKey, createdDate, lastUsed, createMsg)
	}
	return nil
}
func ListApiKeys ( db * sql . DB ) error { result , err := db . Query ( " " ) if err != nil { return fmt . Errorf ( " " , err ) } defer result . Close ( ) fmt . Printf ( " \n " , " " , " " , " " , " " ) for result . Next ( ) { var apiKey string var createdDate string var lastUsedNull sql . NullString var lastUsed string var createMsg string result . Scan ( & apiKey , & createdDate , & lastUsedNull , & createMsg ) if lastUsedNull . Valid { lastUsed = lastUsedNull . String } else { lastUsed = " " } fmt . Printf ( " \n " , apiKey , createdDate , lastUsed , createMsg ) } return nil }
ListApiKeys lists all keys in the keys table
ListApiKeys lists all keys in the keys table