Documentation ¶
Index ¶
- Constants
- func BinaryBufferToBytes(binBuffer *bytes.Buffer) ([]byte, error)
- func BitToBool(b byte) bool
- func BoolToBit(b bool) byte
- func BoolToRune(b bool) rune
- func ByteArrToBits(byteArr []byte, resultChan chan byte)
- func BytesToUint64(bytes []byte) uint64
- func ClearBit(n byte, pos byte) byte
- func EncodeNRGBA(nrgba *image.NRGBA) (*bytes.Buffer, error)
- func GenerateToken(ctx context.Context, entUser ent.User) (string, *time.Time, error)
- func GetUpdatedByte(newBit byte, value byte, lsbPos byte) byte
- func HasBit(n byte, pos byte) bool
- func ImageToNRGBA(img image.Image) (*image.NRGBA, int, int)
- func NewAuthorizationError(ctx context.Context, message string) *gqlerror.Error
- func NewDBError(ctx context.Context, message string) *gqlerror.Error
- func NewInternalServerError(ctx context.Context, message string) *gqlerror.Error
- func NewNotFoundError(ctx context.Context, message string) *gqlerror.Error
- func NewValidationError(ctx context.Context, message string) *gqlerror.Error
- func ParseToken(tokenStr string) (ulid.ID, error)
- func ReadImageFile(file io.Reader) (image.Image, error)
- func SetBit(n byte, pos byte) byte
- func Trim(src string, toTrim uint8) string
- func Uint64ToBytes(num uint64) []byte
- type Channel
- type ErrorCode
- type ImageData
Constants ¶
const BitLength = 8
Variables ¶
This section is empty.
Functions ¶
func BinaryBufferToBytes ¶
BinaryBufferToBytes turns the data from bytes.Buffer into a slice of bytes.
func ByteArrToBits ¶
ByteArrToBits turns given byteArr into bits and sends it over a channel.
func EncodeNRGBA ¶
EncodeNRGBA encodes given image.NRGBA into a bytes.Buffer.
func GenerateToken ¶
GenerateToken created a jwt token and puts an ulid.ID into its claims.
func GetUpdatedByte ¶
GetUpdatedByte updates value byte with newBit byte on lsbPos byte.
func ImageToNRGBA ¶
ImageToNRGBA converts image.Image to image.NRGBA.
func NewAuthorizationError ¶
NewAuthorizationError returns a new gqlerror.Error with authorization ErrorCode.
func NewDBError ¶
NewDBError returns a new gqlerror.Error with db ErrorCode.
func NewInternalServerError ¶
NewInternalServerError returns a new gqlerror.Error with internalServer ErrorCode.
func NewNotFoundError ¶
NewNotFoundError returns a new gqlerror.Error with notFound ErrorCode.
func NewValidationError ¶
NewValidationError returns a new gqlerror.Error with validation ErrorCode.
func ParseToken ¶
ParseToken parses a jwt token and returns the ulid.ID in its claims.
func ReadImageFile ¶
ReadImageFile reads given file and returns image.Image.
func Uint64ToBytes ¶
Uint64ToBytes turns int to []byte representing uint64.
Types ¶
type Channel ¶
type Channel string
Channel defines the type for the "channel" enum field.
const ( ChannelRed Channel = "RED" ChannelGreen Channel = "GREEN" ChannelBlue Channel = "BLUE" ChannelRedGreen Channel = "RED_GREEN" ChannelRedBlue Channel = "RED_BLUE" ChannelGreenBlue Channel = "GREEN_BLUE" ChannelRedGreenBlue Channel = "RED_GREEN_BLUE" )
Channel values.
func (Channel) IncludesBlue ¶
IncludesBlue returns whether the Channel includes Channel with blue value.
func (Channel) IncludesGreen ¶
IncludesGreen returns whether the Channel includes Channel with green value.
func (Channel) IncludesRed ¶
IncludesRed returns whether the Channel includes Channel with red value.
type ImageData ¶
ImageData represents a data of an image.NRGBA and Width and Height.
func FileToImageData ¶
FileToImageData reads file and returns ImageData.
func (ImageData) PixelCount ¶
PixelCount returns the number of pixels of the image represented.