drone/internal/store/transformation.go
Johannes Batzill 06721dcf20 [Techdebt] merge user/service/serviceaccount stores into single principal store (#160)
This change merges the `UserStore`, `ServiceStore`, and `ServiceAccountStore` into a single `PrincipalStore`.
2023-01-05 15:58:18 -08:00

26 lines
963 B
Go

// Copyright 2022 Harness Inc. All rights reserved.
// Use of this source code is governed by the Polyform Free Trial License
// that can be found in the LICENSE.md file for this repository.
package store
import (
"strings"
)
// PrincipalUIDTransformation transforms a principalUID to a value that should be duplicate free.
// This allows us to simply switch between principalUIDs being case sensitive, insensitive or anything inbetween.
type PrincipalUIDTransformation func(uid string) (string, error)
func ToLowerPrincipalUIDTransformation(uid string) (string, error) {
return strings.ToLower(uid), nil
}
// PathTransformation transforms a path to a value that should be duplicate free.
// This allows us to simply switch between paths being case sensitive, insensitive or anything inbetween.
type PathTransformation func(string) (string, error)
func ToLowerPathTransformation(original string) (string, error) {
return strings.ToLower(original), nil
}