chore: tweak common function

This commit is contained in:
Steven
2024-05-26 11:02:23 +08:00
parent a177800e83
commit 1ccfa81cf3
12 changed files with 54 additions and 49 deletions

View File

@ -1,7 +1,6 @@
package v1
import (
"context"
"encoding/base64"
"github.com/pkg/errors"
@ -33,20 +32,6 @@ func convertRowStatusToStore(rowStatus v1pb.RowStatus) store.RowStatus {
}
}
func getCurrentUser(ctx context.Context, s *store.Store) (*store.User, error) {
username, ok := ctx.Value(usernameContextKey).(string)
if !ok {
return nil, nil
}
user, err := s.GetUser(ctx, &store.FindUser{
Username: &username,
})
if err != nil {
return nil, err
}
return user, nil
}
func getPageToken(limit int, offset int) (string, error) {
return marshalPageToken(&v1pb.PageToken{
Limit: int32(limit),