Skip to content

Commit

Permalink
fix: Base64 data member is private (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
whg517 authored Feb 7, 2024
1 parent f0e0ba1 commit 99c6334
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/util/base64.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package util
import "encoding/base64"

type Base64[T []byte | string] struct {
data T
Data T
}

func (b Base64[T]) Encode() T {
switch v := any(b.data).(type) {
switch v := any(b.Data).(type) {
case []byte:
str := base64.StdEncoding.EncodeToString(v)
return T(str)
Expand All @@ -20,7 +20,7 @@ func (b Base64[T]) Encode() T {
}

func (b Base64[T]) Decode() (T, error) {
switch v := any(b.data).(type) {
switch v := any(b.Data).(type) {
case []byte:
bytes, err := base64.StdEncoding.DecodeString(string(v))
if err != nil {
Expand Down

0 comments on commit 99c6334

Please sign in to comment.