package main import ( "fmt" "regexp" "strings" "t0xa/pdf_to_txt/internal/parser" "t0xa/pdf_to_txt/internal/regexper" ) type CheckEntry struct { Product string Price string } func main() { // TODO: Redo format of file passing to function text := parser.ParseX5Check("./internal/parser/testfiles/test4.pdf") split := strings.Split(text, "\n") stringsToFilter := "https://mail|Gmail - Электронный чек|Сумма|НДС" re := regexp.MustCompile(stringsToFilter) filtered := []string{} for _, element := range split { if re.MatchString(element) { continue } if len(element) < 1 { continue } filtered = append(filtered, element) } for index, element := range filtered { if element == "Цена*Кол" { clearedProductName := regexper.MSymbolsRemover(filtered[index-1]) fmt.Print(clearedProductName + " : ") fmt.Println(filtered[index+1]) fmt.Println("------") } } // ctx := context.Background() // // conn, err := pgx.Connect(ctx, "postgres://ruprod_user:ruprod_password@localhost:5433/ruprod") // if err != nil { // panic(err) // } // defer conn.Close(ctx) // // queries := ruprod.New(conn) // insertedProduct, err := queries.CreateProduct(ctx, ruprod.CreateProductParams{ // Name: "Сырок", // Price: pgtype.Float8{Float64: 12.9, Valid: true}, // PurchaseDate: pgtype.Timestamp{Time: time.Now()}, // }) // if err != nil { // panic(err) // } // fmt.Println(insertedProduct) // ctx := context.Background() // // TODO: Move to env file // conn, err := pgx.Connect(ctx, "postgres://ruprod_user:ruprod_password@localhost:5433/ruprod") // if err != nil { // panic(err) // } // defer conn.Close(ctx) // // if err := migrator.Migrate(ctx, conn); err != nil { // log.Fatalf("Migration failed: %s", err) // } }