utils

package
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const TOKEN_PREFIX = "emo:"

Variables

This section is empty.

Functions

func APIGetRequest

func APIGetRequest(token, endpoint string) ([]byte, error)

func CheckTokenPrefix

func CheckTokenPrefix(token string) error

func GenerateToken

func GenerateToken() (string, error)

func RandAlphabetAndNumberString

func RandAlphabetAndNumberString(n int) string

RandAlphabetAndNumberString 指定した文字数のランダム英数字文字列を生成します

func SecureRandomString

func SecureRandomString(n int) (string, error)

SecureRandomString 小文字英字と数字からなるランダムな暗号論的にセキュアな文字列を生成する

Types

type Int

type Int struct {
	sql.NullInt64
}

func IntFrom

func IntFrom(v int64) Int

func NewInt

func NewInt(v int64, valid bool) Int

func (Int) MarshalJSON

func (i Int) MarshalJSON() ([]byte, error)

func (Int) MarshalText

func (i Int) MarshalText() ([]byte, error)

func (*Int) UnmarshalJSON

func (i *Int) UnmarshalJSON(data []byte) error

func (*Int) UnmarshalText

func (i *Int) UnmarshalText(text []byte) error

func (Int) ValueOrZero

func (i Int) ValueOrZero() int64

type String

type String struct {
	sql.NullString
}

func NewString

func NewString(v string, valid bool) String

func StringFrom

func StringFrom(v string) String

func (String) MarshalJSON

func (s String) MarshalJSON() ([]byte, error)

func (String) MarshalText

func (s String) MarshalText() ([]byte, error)

func (*String) UnmarshalJSON

func (s *String) UnmarshalJSON(data []byte) error

func (*String) UnmarshalText

func (s *String) UnmarshalText(text []byte) error

func (String) ValueOrZero

func (s String) ValueOrZero() string

type UserMe

type UserMe struct {
	Id   uuid.UUID `json:"id"`
	Name string    `json:"name"`
}

func GetUserMe

func GetUserMe(token string) (*UserMe, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL