parser

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2025 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package parser provides CSV recipient filtering using logical expressions.

This file implements the high-level Filter() function that: - Applies a logical expression to each recipient - Normalizes field names to lowercase - Supports email fallback field

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSheetCSVStream

func GetSheetCSVStream(sheetURL string) (io.ReadCloser, error)

GetSheetCSVStream fetches a Google Sheet as a CSV stream. It extracts the sheet ID and GID from the provided URL and constructs the export URL.

Types

type Recipient

type Recipient struct {
	Email string
	Data  map[string]string
}

func Filter

func Filter(recipients []Recipient, exp expression.Expression) []Recipient

Filter applies the provided logical EXPRESSION to a slice of recipients. It returns only those recipients for whom the expression evaluates to true.

The expression is evaluated case-insensitively, and field names are normalized to lowercase.

func ParseCSV

func ParseCSV(path string) ([]Recipient, error)

ParseCSV reads a CSV file from a given path and returns a list of Recipients. This is a wrapper around ParseCSVFromReader for convenience.

func ParseCSVFromReader

func ParseCSVFromReader(reader io.Reader) ([]Recipient, error)

ParseCSVFromReader reads a CSV from any io.Reader and returns a list of Recipients. It expects one column to be named 'email' and uses other columns as dynamic data.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL