moved checksum function to its own interface

its not needed that all barcodes have an integer checksum
so it should not be needed in every implementation.
This commit is contained in:
Florian Sundermann committed 2017-01-26 08:20:38 +01:00
1 parent fe0f26ff6d
commit b066487b3e
11 files changed
+57 -34

No files matched your search

+2 -2
View File
@@ -113,7 +113,7 @@ func prepare(content string) (string, error) {
// Encode returns a code39 barcode for the given content
// if includeChecksum is set to true, a checksum character is calculated and added to the content
func Encode(content string, includeChecksum bool, fullASCIIMode bool) (barcode.Barcode, error) {
func Encode(content string, includeChecksum bool, fullASCIIMode bool) (barcode.BarcodeIntCS, error) {
if fullASCIIMode {
var err error
content, err = prepare(content)
@@ -148,5 +148,5 @@ func Encode(content string, includeChecksum bool, fullASCIIMode bool) (barcode.B
if err != nil {
checkSum = 0
}
return utils.New1DCode("Code 39", content, result, int(checkSum)), nil
return utils.New1DCodeIntCheckSum("Code 39", content, result, int(checkSum)), nil
}