cookiestore

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Rendered for js/wasm

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cookie struct {
	Domain      string   `json:"domain"`
	Expires     int64    `json:"expires"`
	Name        string   `json:"name"`
	Partitioned bool     `json:"partitioned"`
	Path        string   `json:"path"`
	SameSite    SameSite `json:"sameSite"`
	Secure      bool     `json:"secure"`
	Value       string   `json:"value"`
}

func ToCookie

func ToCookie(value js.Value) *Cookie

type CookieStore added in v0.0.8

type CookieStore struct {
	Value *js.Value `json:"value"`
}

func GetCookieStore added in v0.0.8

func GetCookieStore() *CookieStore

Returns the global CookieStore instance.

func (*CookieStore) Delete added in v0.0.8

func (cookiestore *CookieStore) Delete(options DeleteOptions) error

Deletes a matching Cookie from the CookieStore.

Example
// import "github.com/cookiengineer/gooey/bindings/console"

console := console.GetConsole()
cookiestore := GetCookieStore()

err := cookiestore.Delete(DeleteOptions{
	Name:        "username",
	Domain:      "example.com",
	Path:        "/login",
	Partitioned: true,
})

if err == nil {
	console.Info("Cookie \"username\" deleted!")
} else {
	console.Error(err)
}

func (*CookieStore) Get added in v0.0.8

func (cookiestore *CookieStore) Get(options GetOptions) (*Cookie, error)

Returns a matching Cookie from the CookieStore.

Example
// import "github.com/cookiengineer/gooey/bindings/console"

console := console.GetConsole()
cookiestore := GetCookieStore()

cookie, err := cookiestore.Get(GetOptions{
	Name: "username",
	Url:  "https://example.com/login",
})

if err == nil {

	// Cookie{
	//   Domain:      "example.com",
	//   Expires:     1767139200000,
	//   Name:        "username",
	//   Partitioned: true,
	//   Path:        "/login",
	//   SameSite:    SameSite("strict"),
	//   Secure:      true,
	//   Value:       "cookiengineer",
	// }

	console.Info(cookie)

} else {
	console.Error(err)
}

func (*CookieStore) GetAll added in v0.0.8

func (cookiestore *CookieStore) GetAll(options *GetOptions) ([]*Cookie, error)

Returns all matching Cookies from the CookieStore.

Example
// import "github.com/cookiengineer/gooey/bindings/console"

console := console.GetConsole()
cookiestore := GetCookieStore()

cookies, err := cookiestore.GetAll(GetOptions{
	Name: "username",
	Url:  "https://example.com/login",
})

if err == nil {

	// []Cookie{
	//   {
	//     Domain:      "example.com",
	//     Expires:     1767139200000,
	//     Name:        "username",
	//     Partitioned: true,
	//     Path:        "/login",
	//     SameSite:    SameSite("strict"),
	//     Secure:      true,
	//     Value:       "cookiengineer",
	//   }, {
	//     Domain:      "example.com",
	//     Expires:     1767139200000,
	//     Name:        "PHPSESSID",
	//     Partitioned: true,
	//     Path:        "/login",
	//     SameSite:    SameSite("strict"),
	//     Secure:      false,
	//     Value:       "13371337",
	//   }
	// }

	console.Info(cookies)

} else {
	console.Error(err)
}

func (*CookieStore) Set added in v0.0.8

func (cookiestore *CookieStore) Set(options SetOptions) error

Stores a Cookie to the CookieStore.

Example
// import "github.com/cookiengineer/gooey/bindings/console"

console := console.GetConsole()
cookiestore := GetCookieStore()

err := cookiestore.Set(SetOptions{
	Domain:      "example.com",
	Expires:     1767139200000,
	Name:        "username",
	Partitioned: true,
	Path:        "/login",
	SameSite:    &SameSite("strict"),
	Secure:      true,
	Value:       "cookiengineer",
})

if err == nil {
	console.Info("Cookie \"username\" has been stored!")
} else {
	console.Error(err)
}

type DeleteOptions

type DeleteOptions struct {
	Name        string `json:"name"`
	Domain      string `json:"domian"`
	Path        string `json:"path"`
	Partitioned bool   `json:"partitioned"`
}

func (DeleteOptions) MapToJS

func (options DeleteOptions) MapToJS() map[string]any

type GetOptions

type GetOptions struct {
	Name string `json:"name"`
	Url  string `json:"url"`
}

func (GetOptions) MapToJS

func (options GetOptions) MapToJS() map[string]any

type SameSite

type SameSite string
const (
	SameSiteStrict SameSite = "strict"
	SameSiteLax    SameSite = "lax"
	SameSiteNone   SameSite = "none"
)

func (SameSite) String

func (samesite SameSite) String() string

type SetOptions

type SetOptions struct {
	Domain      string    `json:"domain"`
	Expires     int       `json:"expires"`
	Name        string    `json:"name"`
	Partitioned bool      `json:"partitioned"`
	Path        string    `json:"path"`
	SameSite    *SameSite `json:"sameSite"`
	Value       string    `json:"value"`
}

func (SetOptions) MapToJS

func (options SetOptions) MapToJS() map[string]any

Jump to

Keyboard shortcuts

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