MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / sourceOrSourcesValidation

Function sourceOrSourcesValidation

api/model/model.go:47–54  ·  view source on GitHub ↗
(t *RecordTransaction)

Source from the content-addressed store, hash-verified

45}
46
47func sourceOrSourcesValidation(t *RecordTransaction) validation.RuleFunc {
48 return func(value interface{}) error {
49 if (t.Source == "" && len(t.Sources) == 0) || (t.Source != "" && len(t.Sources) > 0) {
50 return errors.New("either source or sources is required, not both")
51 }
52 return nil
53 }
54}
55
56func destinationOrDestinationsValidation(t *RecordTransaction) validation.RuleFunc {
57 return func(value interface{}) error {

Callers 2

Calls

no outgoing calls

Tested by 1