corso/src/internal/m365/exchange/cache_container.go
Keepers 2f6d731993
rename connector -> m365 (#3600)
renames /internal/connector to /internal/m365.  No logic changes in this PR.  Only the dir rename, import renames, and one linter shadowing rename.

---

#### Does this PR need a docs update or release note?

- [x]  No

#### Type of change

- [x] 🧹 Tech Debt/Cleanup

#### Issue(s)

* #1996

#### Test Plan

- [x]  Unit test
- [x] 💚 E2E
2023-06-13 18:35:39 +00:00

38 lines
946 B
Go

package exchange
import (
"github.com/alcionai/clues"
"github.com/alcionai/corso/src/internal/common/ptr"
"github.com/alcionai/corso/src/internal/m365/graph"
)
// checkIDAndName is a helper function to ensure that
// the ID and name pointers are set prior to being called.
func checkIDAndName(c graph.Container) error {
id, ok := ptr.ValOK(c.GetId())
if !ok {
return clues.New("container missing ID")
}
if _, ok := ptr.ValOK(c.GetDisplayName()); !ok {
return clues.New("container missing display name").With("container_id", id)
}
return nil
}
// checkRequiredValues is a helper function to ensure that
// all the pointers are set prior to being called.
func checkRequiredValues(c graph.Container) error {
if err := checkIDAndName(c); err != nil {
return err
}
if _, ok := ptr.ValOK(c.GetParentFolderId()); !ok {
return clues.New("container missing parent ID").With("container_id", ptr.Val(c.GetId()))
}
return nil
}