Documentation
ΒΆ
Index ΒΆ
- func CountSegments(input string) (int, error)
- func DetectType(input string) (string, error)
- func GetElementValue(input, segmentTag string, elementPosition int) (string, error)
- func GetSegment(input, tag string) (*model.Segment, error)
- func GetSegments(input, tag string) ([]*model.Segment, error)
- func IsValid(input string) bool
- func Parse(input string) (*model.Message, error)
- func ParseFromReader(reader io.Reader) (*model.Message, error)
- func ToJSON(input string) ([]byte, error)
- func ToJSONString(input string) (string, error)
- type Converter
- func (c *Converter) ConvertMessageToJSON(message *model.Message) ([]byte, error)
- func (c *Converter) ConvertToJSON(edifactString string) ([]byte, error)
- func (c *Converter) ConvertToJSONString(edifactString string) (string, error)
- func (c *Converter) ConvertToStructured(edifactString string) (interface{}, error)
- func (c *Converter) GetParser() *parser.Parser
- func (c *Converter) GetRouter() *dispatcher.Router
- func (c *Converter) GetSupportedMessageTypes() []string
- func (c *Converter) HasHandler(messageType string) bool
- func (c *Converter) RegisterHandler(messageType string, handler model.MessageHandler)
- type Detector
- func (d *Detector) DetectMessageInfo(edifactString string) (*MessageInfo, error)
- func (d *Detector) DetectMessageInfoFromMessage(message *model.Message) (*MessageInfo, error)
- func (d *Detector) DetectMessageType(edifactString string) (string, error)
- func (d *Detector) DetectMessageTypeFromMessage(message *model.Message) (string, error)
- func (d *Detector) DetectMessageTypeFromSegment(unhSegment string) (string, error)
- func (d *Detector) DetectMessageVersion(edifactString string) (string, error)
- func (d *Detector) DetectMessageVersionFromMessage(message *model.Message) (string, error)
- func (d *Detector) GetMessageInfo(edifactString string) (*MessageInfo, error)
- func (d *Detector) IsEDIFACT(edifactString string) bool
- func (d *Detector) ValidateMessage(edifactString string) (bool, []string)
- type MessageInfo
- type Reader
- func (r *Reader) GetConfig() model.EDIFACTConfig
- func (r *Reader) GetParser() *parser.Parser
- func (r *Reader) ReadFrom(reader io.Reader) (*model.Message, error)
- func (r *Reader) ReadSegment(segmentStr string) (*model.Segment, error)
- func (r *Reader) ReadString(input string) (*model.Message, error)
- func (r *Reader) SetConfig(config model.EDIFACTConfig)
- func (r *Reader) ValidateMessage(message *model.Message) error
- type SimpleMessageInfo
Constants ΒΆ
This section is empty.
Variables ΒΆ
This section is empty.
Functions ΒΆ
func CountSegments ΒΆ
CountSegments counts the number of segments in an EDIFACT message
func DetectType ΒΆ
DetectType detects the message type from an EDIFACT string
func GetElementValue ΒΆ
GetElementValue gets the value of an element from a specific segment
func GetSegment ΒΆ
GetSegment returns the first segment with the given tag
func GetSegments ΒΆ
GetSegments returns all segments with the given tag
func ParseFromReader ΒΆ
ParseFromReader parses EDIFACT data from an io.Reader
func ToJSONString ΒΆ
ToJSONString converts an EDIFACT string to a JSON string
Types ΒΆ
type Converter ΒΆ
type Converter struct {
// contains filtered or unexported fields
}
Converter provides functionality to convert EDIFACT messages to structured formats
func NewConverter ΒΆ
func NewConverter() *Converter
NewConverter creates a new EDIFACT converter with default configuration
func NewConverterWithConfig ΒΆ
func NewConverterWithConfig(config model.EDIFACTConfig) *Converter
NewConverterWithConfig creates a new EDIFACT converter with custom configuration
func (*Converter) ConvertMessageToJSON ΒΆ
ConvertMessageToJSON converts a parsed message to JSON
func (*Converter) ConvertToJSON ΒΆ
ConvertToJSON converts an EDIFACT string to JSON
func (*Converter) ConvertToJSONString ΒΆ
ConvertToJSONString converts an EDIFACT string to a JSON string
func (*Converter) ConvertToStructured ΒΆ
ConvertToStructured converts an EDIFACT string to structured data
func (*Converter) GetRouter ΒΆ
func (c *Converter) GetRouter() *dispatcher.Router
GetRouter returns the underlying router (for advanced usage)
func (*Converter) GetSupportedMessageTypes ΒΆ
GetSupportedMessageTypes returns a list of supported message types
func (*Converter) HasHandler ΒΆ
HasHandler checks if a handler exists for the given message type
func (*Converter) RegisterHandler ΒΆ
func (c *Converter) RegisterHandler(messageType string, handler model.MessageHandler)
RegisterHandler registers a custom message handler
type Detector ΒΆ
type Detector struct {
// contains filtered or unexported fields
}
Detector provides functionality to detect EDIFACT message types
func NewDetector ΒΆ
func NewDetector() *Detector
NewDetector creates a new EDIFACT detector with default configuration
func NewDetectorWithConfig ΒΆ
func NewDetectorWithConfig(config model.EDIFACTConfig) *Detector
NewDetectorWithConfig creates a new EDIFACT detector with custom configuration
func (*Detector) DetectMessageInfo ΒΆ
func (d *Detector) DetectMessageInfo(edifactString string) (*MessageInfo, error)
DetectMessageInfo detects both message type and version from an EDIFACT string
func (*Detector) DetectMessageInfoFromMessage ΒΆ
func (d *Detector) DetectMessageInfoFromMessage(message *model.Message) (*MessageInfo, error)
DetectMessageInfoFromMessage detects both message type and version from a parsed message
func (*Detector) DetectMessageType ΒΆ
DetectMessageType detects the message type from an EDIFACT string
func (*Detector) DetectMessageTypeFromMessage ΒΆ
DetectMessageTypeFromMessage detects the message type from a parsed message
func (*Detector) DetectMessageTypeFromSegment ΒΆ
DetectMessageTypeFromSegment detects the message type from a UNH segment string
func (*Detector) DetectMessageVersion ΒΆ
DetectMessageVersion detects the message version from an EDIFACT string
func (*Detector) DetectMessageVersionFromMessage ΒΆ
DetectMessageVersionFromMessage detects the message version from a parsed message
func (*Detector) GetMessageInfo ΒΆ
func (d *Detector) GetMessageInfo(edifactString string) (*MessageInfo, error)
GetMessageInfo returns detailed information about an EDIFACT message
type MessageInfo ΒΆ
type MessageInfo struct {
Type string `json:"type"`
Version string `json:"version"`
SegmentCount int `json:"segment_count"`
}
MessageInfo contains information about an EDIFACT message
func (*MessageInfo) String ΒΆ
func (m *MessageInfo) String() string
String returns a string representation of the message info
type Reader ΒΆ
type Reader struct {
// contains filtered or unexported fields
}
Reader provides functionality to read and parse EDIFACT messages
func NewReader ΒΆ
func NewReader() *Reader
NewReader creates a new EDIFACT reader with default configuration
func NewReaderWithConfig ΒΆ
func NewReaderWithConfig(config model.EDIFACTConfig) *Reader
NewReaderWithConfig creates a new EDIFACT reader with custom configuration
func (*Reader) GetConfig ΒΆ
func (r *Reader) GetConfig() model.EDIFACTConfig
GetConfig returns the current configuration
func (*Reader) ReadSegment ΒΆ
ReadSegment reads and parses a single EDIFACT segment
func (*Reader) ReadString ΒΆ
ReadString reads and parses an EDIFACT string
func (*Reader) SetConfig ΒΆ
func (r *Reader) SetConfig(config model.EDIFACTConfig)
SetConfig updates the configuration and recreates the parser
type SimpleMessageInfo ΒΆ
type SimpleMessageInfo struct {
Type string `json:"type"`
MessageRef string `json:"message_ref"`
SegmentCount int `json:"segment_count"`
}
SimpleMessageInfo contains basic information about an EDIFACT message
func GetMessageInfo ΒΆ
func GetMessageInfo(input string) (*SimpleMessageInfo, error)
GetMessageInfo returns basic information about an EDIFACT message
func (*SimpleMessageInfo) String ΒΆ
func (m *SimpleMessageInfo) String() string
String returns a string representation of the message info
Directories
ΒΆ
| Path | Synopsis |
|---|---|
|
examples
|
|
|
01_basic_reader
command
|
|
|
02_generic_converter
command
|
|
|
03_message_detector
command
|
|
|
04_custom_config
command
|
|
|
05_segment_access
command
|
|
|
06_error_handling
command
|
|
|
07_validation
command
|
|
|
08_performance
command
|
|
|
knowledge/course_advance/lesson1
command
|
|
|
knowledge/course_advance/lesson2
command
|
|
|
knowledge/course_advance/lesson3
command
|
|
|
knowledge/course_advance/lesson4
command
|
|
|
knowledge/course_advance/lesson5
command
|
|
|
knowledge/course_advance/lesson6
command
|
|
|
knowledge/course_advance/lesson7
command
|
|
|
knowledge/course_advance/lesson8
command
|
|
|
knowledge/sample_advanced
command
|
|
|
knowledge/sample_basic
command
|
|
|
knowledge/sample_generic
command
|
|
|
knowledge/simple_adapter
command
|
|