Help us shape the future of Go! Take the 2026 Go Developer Survey

basic

command
v1.26.6 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 3 Imported by: 0

README

Basic — Core Packet API

Минимальный пример работы с пакетами TDTP напрямую через Go API (без БД и брокеров).

Что показывает

  1. Reference — создание пакета с таблицей клиентов, запись в XML
  2. Parse — чтение и разбор XML обратно в структуры
  3. Request — создание запроса с TDTQL фильтрами (IsActive=1 AND Balance>1000)
  4. Response — ответ на запрос с QueryContext (статистика выполнения)

Запуск

go run main.go

Файлы сохраняются во /tmp/: reference_part_1.xml, request.xml, response.xml.

Ключевые API

generator := packet.NewGenerator()

// Reference
packets, _ := generator.GenerateReference("CustTable", schema, rows)

// Request с фильтром
query := packet.NewQuery()
query.Filters = &packet.Filters{And: &packet.LogicalGroup{...}}
requestPkt, _ := generator.GenerateRequest("CustTable", query, "SystemA", "SystemB")

// Response с QueryContext
responsePkts, _ := generator.GenerateResponse("CustTable", requestPkt.Header.MessageID,
    schema, rows, queryContext, "SystemB", "SystemA")

// Парсинг
parser := packet.NewParser()
pkt, _ := parser.ParseFile("file.xml")
values := parser.GetRowValues(pkt.Data.Rows[0])

См. также

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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