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

Function destinationOrDestinationsValidation

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

Source from the content-addressed store, hash-verified

54}
55
56func destinationOrDestinationsValidation(t *RecordTransaction) validation.RuleFunc {
57 return func(value interface{}) error {
58 if (t.Destination == "" && len(t.Destinations) == 0) || (t.Destination != "" && len(t.Destinations) > 0) {
59 return errors.New("either destination or destinations is required, not both")
60 }
61 return nil
62 }
63}
64
65func (l *CreateLedger) ValidateCreateLedger() error {
66 return validation.ValidateStruct(l,

Calls

no outgoing calls

Tested by 1