24a038ec3d
DocTextRunner Structure * firstround * shorttests
49 lines
942 B
Go
49 lines
942 B
Go
package document
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type IsTextExtractedParams struct {
|
|
DocumentID uuid.UUID
|
|
MinCleanVersion int32
|
|
MinTextVersion int32
|
|
}
|
|
|
|
func (s *Service) IsTextExtracted(params *IsTextExtractedParams) error {
|
|
// TODO
|
|
return nil
|
|
}
|
|
|
|
func (s *Service) GetCleanVersion() int32 {
|
|
// TODO - actual version
|
|
return 1
|
|
}
|
|
|
|
func (s *Service) GetTextVersion() int32 {
|
|
// TODO - actual version
|
|
return 1
|
|
}
|
|
|
|
func (s *Service) IsValidCleanVersion(v int32) error {
|
|
currentVersion := s.GetCleanVersion()
|
|
|
|
if v < 1 || v > currentVersion {
|
|
return fmt.Errorf("document clean code version must be in the range 0 < version <= %d", currentVersion)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (s *Service) IsValidTextVersion(v int32) error {
|
|
currentVersion := s.GetTextVersion()
|
|
|
|
if v < 1 || v > currentVersion {
|
|
return fmt.Errorf("document text code version must be in the range 0 < version <= %d", currentVersion)
|
|
}
|
|
|
|
return nil
|
|
}
|