aar

package module
v0.0.0-...-f567432 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2025 License: BSD-3-Clause Imports: 8 Imported by: 0

README

AAR

Simple API Authentication Result

Usage

aar, err := aar.New("UNIQUE-NAME-IN-YOUR-APP%s%d", "abc", 123)
if err != nil {
    return
}

token, err := aar.SetDurcation(10).Read()
if err != nil {
    // Get token
    token = app.GetToken()
    aar.Write(token)
}
// Use token in you app

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AAR

type AAR struct {
	// contains filtered or unexported fields
}

func New

func New(name string, args ...any) (*AAR, error)

func (*AAR) Read

func (aar *AAR) Read() (string, error)

Read reads token from cache file if exists, and will be checked expiration time

func (*AAR) SetDuration

func (aar *AAR) SetDuration(d time.Duration) *AAR

SetDuration set expiration time

func (*AAR) SetExpiredTime

func (aar *AAR) SetExpiredTime(d time.Time) *AAR

SetExpiredTime set expiration time if you only know the expiration time

func (*AAR) Write

func (aar *AAR) Write(content []byte) error

Write writes token to cache file

Jump to

Keyboard shortcuts

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