user

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 7 Imported by: 0

README

tinywasm/user

User management library for the tinywasm ecosystem. Handles user entities, login credentials, authentication, session management, and RBAC.

In v0.2.0, the system has been refactored to make authority a pure orchestrator, decoupling authentication modes and session strategies into completely independent, injectable components.

Package Structure

Package Purpose
github.com/tinywasm/user WASM-safe root package defining contracts, ports, common models, and DTOs
github.com/tinywasm/user/session/cookie Stateful opaque session IDs stored in HttpOnly cookies (default)
github.com/tinywasm/user/session/jwt Stateless cryptographically signed JWT sessions (carried in HttpOnly cookies or Bearer headers)
github.com/tinywasm/user/email_password Independent email+password credential authenticator
github.com/tinywasm/user/trusted_ip Independent Chilean RUT checksum and IP allowlist authenticator
github.com/tinywasm/user/oauth2 Independent OAuth2 begin/callback flow authenticator
github.com/tinywasm/user/authority Pure orchestrator carrying database tables, RBAC rules, central operations, and logout endpoints

Documentation


Getting Started (Complete Guide)

Here is a complete, edge-compatible example demonstrating how to set up the database connection, initialize the authority orchestrator with a JWT session strategy, configure two authentication modes, protect paths, and seed initial data.

package main

import (
	"github.com/tinywasm/model"
	"github.com/tinywasm/orm"
	"github.com/tinywasm/router"
	"github.com/tinywasm/server/httpd"
	"github.com/tinywasm/sqlite"
	"github.com/tinywasm/unixid"
	"github.com/tinywasm/user"
	"github.com/tinywasm/user/authority"
	emailpassword "github.com/tinywasm/user/email_password"
	"github.com/tinywasm/user/session/jwt"
	trustedip "github.com/tinywasm/user/trusted_ip"
)

func main() {
	// 1. Establish database connection and wrap in ORM
	conn, err := sqlite.Open("app.db")
	if err != nil {
		panic(err)
	}
	db := orm.New(conn)

	// 2. Generate required ID Generator (e.g. tinywasm/unixid)
	ids, err := unixid.NewUnixID()
	if err != nil {
		panic(err)
	}

	// 3. Initialize the pure authority orchestrator
	m, err := authority.New(db, user.Config{
		IDs:        ids,
		CookieName: "session",
		TokenTTL:   86400, // 24 hours
		TrustProxy: true,
	})
	if err != nil {
		panic(err)
	}

	// 4. Opt into a stateless JWT strategy (replacing default cookie session)
	secret := []byte("your-secret-key-must-be-32-bytes")
	strategy, err := jwt.New(secret, 86400, m, m)
	if err != nil {
		panic(err)
	}
	m.SetStrategy(strategy)

	// 5. Construct and configure authentication modes.
	// We inject Module 'm' which implements the narrow ports.
	//
	// emailpassword.New receives 'm' three times:
	// - 1st 'm' (user.IdentityStore): finds user identities & verifies passwords
	// - 2nd 'm' (user.SessionIssuer): issues cookies/JWT sessions on login
	// - 3rd 'm' (user.SecurityNotifier): reports logins/failures to events publisher
	epAuth := emailpassword.New(m, m, m, emailpassword.WithTrustProxy(true))

	// trustedip.New receives 'm' four times:
	// - 1st 'm' (user.IdentityStore): resolves users/identities
	// - 2nd 'm' (user.TrustedIPStore): checks if the caller's IP is allowed
	// - 3rd 'm' (user.SessionIssuer): issues the session
	// - 4th 'm' (user.SecurityNotifier): publishes security events (IPMismatch, etc.)
	// - true: trust proxy headers for IP check
	tiAuth := trustedip.New(m, m, m, m, true)

	// 6. Enable the authenticators in the authority orchestrator
	m.Enable(epAuth, tiAuth)

	// 7. Mount central user APIs and start the server.
	// The concrete Router is managed by httpd under the hood.
	// Authn globally identifies the user and injects their ID in ctx.UserID().
	// Authorize evaluates declarative RBAC checks specified on routes via .Requires(...).
	srv := httpd.New(httpd.Config{
		Port:      "8080",
		Authn:     m.Authenticate(), // router.Middleware: identifies the user and injects their ID
		Authorize: m.Can,            // model.Authorizer: central RBAC evaluator
	}).Mount(m)                      // m is a router.APIModule -> mounts central flows (POST /logout, etc.)

	// 8. Protect custom routes.
	// We can declare permission gates via .Requires(...) or check m.Can manually inside the handler.
	srv.Router().Get("/api/dashboard", func(ctx router.Context) {
		if !m.Can(ctx.UserID(), "reports", model.Read) {
			ctx.WriteStatus(403)
			return
		}
		ctx.Write([]byte("Welcome to reports dashboard"))
	}).Requires("reports", model.Read)

	// 9. Bootstrap / Seed first administrator user
	err = m.Bootstrap(authority.Seed{
		Email:    "admin@company.com",
		Password: "super-secure-admin-password",
		Name:     "Administrator",
		Role:     "admin",
		Grants: []model.Grant{
			{Resource: model.Wildcard, Actions: model.AllActions}, // full permissions
		},
	})
	if err != nil {
		panic(err)
	}

	srv.ListenAndServe()
}

Composition Examples

import (
	"github.com/tinywasm/unixid"
	"github.com/tinywasm/user"
	"github.com/tinywasm/user/authority"
	"github.com/tinywasm/user/oauth2"
	"github.com/tinywasm/user/oauth2/provider/google"
)

// Initialize UnixID generator
ids, _ := unixid.NewUnixID()

// Initialize pure orchestrator
m, err := authority.New(db, user.Config{IDs: ids})

// Build Google Provider via struct literal
gProv := &google.GoogleProvider{
	ClientID:     "your-google-client-id",
	ClientSecret: "your-google-client-secret",
	RedirectURL:  "https://miapp.cl/oauth/callback/google",
}

// Construct independent OAuth2 authenticator
oaAuth := oauth2.New(m, m, m, []user.OAuthProvider{gProv})

// Register/enable the authenticator
m.Enable(oaAuth)

// Mount logout and all enabled authenticator login routes
m.MountAPI(router)
Example 2: App with Email/Password + Trusted IP logins and JWT sessions
import (
	"github.com/tinywasm/unixid"
	"github.com/tinywasm/user"
	"github.com/tinywasm/user/authority"
	emailpassword "github.com/tinywasm/user/email_password"
	"github.com/tinywasm/user/session/jwt"
	trustedip "github.com/tinywasm/user/trusted_ip"
)

// Initialize UnixID generator
ids, _ := unixid.NewUnixID()

// Initialize pure orchestrator
m, err := authority.New(db, user.Config{IDs: ids})

// Build and set the stateless JWT session strategy
strategy, err := jwt.New([]byte("your-secret-key-must-be-32-bytes"), 3600, m, m)
m.SetStrategy(strategy)

// Construct authenticators passing orchestrator ports
epAuth := emailpassword.New(m, m, m)
tiAuth := trustedip.New(m, m, m, m, true) // true = trustProxy

// Enable authenticators
m.Enable(epAuth, tiAuth)

// Mount logout and all enabled authenticator login routes
m.MountAPI(router)

Upgrading from v0.1.0 to v0.2.0 (Breaking)

This release shifts Identity.Provider values from "local" and "lan" to "email_password" and "trusted_ip". To upgrade an existing database in production, run the following SQL statements:

UPDATE identity SET provider = 'email_password' WHERE provider = 'local';
UPDATE identity SET provider = 'trusted_ip'    WHERE provider = 'lan';

Diagrams

Production Wiring

tinywasm/user handles authentication flows, while views belong to the consumer.

  1. Mount API: Call m.MountAPI(router) to publish standard authentication routes (POST /login, POST /logout, /oauth/:provider).
  2. Bootstrap: Call m.Bootstrap(Seed) on startup to ensure a first user and their initial role/permissions exist.
  3. Consumer Views: The application builds its own login page using form.New(&user.LoginData{}) and posts to user.PathLogin using JSON.
  4. Protect Routes: Inject m.Authenticate() (middleware) and m.Can (authorization) into your host router.
  5. Client-side gating: Use the me MCP tool to retrieve user profile and permissions for cosmetic UI gating.

Status

Decoupled architecture complete. Orchestrator pure + pluggable auth modes.

Documentation

Index

Constants

View Source
const (
	PathLogin      = "/login"
	PathLogout     = "/logout"
	PathAfterLogin = "/"
)
View Source
const (
	OpMe         = "me"          // authenticated caller's profile
	OpListUsers  = "list_users"  // admin: list users
	OpUpsertUser = "upsert_user" // admin: create (Id=="") or update
	OpDeleteUser = "delete_user" // admin: delete by record
)

Op names — shared vocabulary between the wasm view and the server module.

View Source
const TopicSecurity = "user.security"

TopicSecurity is the events topic every SecurityEvent is published on.

Variables

View Source
var (
	ErrInvalidCredentials = fmt.Err("access", "denied")             // EN: Access Denied                    / ES: Acceso Denegado
	ErrSuspended          = fmt.Err("user", "suspended")            // EN: User Suspended                   / ES: Usuario Suspendido
	ErrEmailTaken         = fmt.Err("email", "registered")          // EN: Email Registered                 / ES: Correo electrónico Registrado
	ErrWeakPassword       = fmt.Err("password", "weak")             // EN: Password Weak                    / ES: Contraseña Débil
	ErrSessionExpired     = fmt.Err("token", "expired")             // EN: Token Expired                    / ES: Token Expirado
	ErrNotFound           = fmt.Err("user", "not", "found")         // EN: User Not Found                   / ES: Usuario No Encontrado
	ErrProviderNotFound   = fmt.Err("provider", "not", "found")     // EN: Provider Not Found               / ES: Proveedor No Encontrado
	ErrInvalidOAuthState  = fmt.Err("state", "invalid")             // EN: State Invalid                    / ES: Estado Inválido
	ErrCannotUnlink       = fmt.Err("identity", "cannot", "unlink") // EN: Identity Cannot Unlink           / ES: Identidad No puede Desvincular
	ErrInvalidRUT         = fmt.Err("rut", "invalid")               // EN: Rut Invalid                      / ES: Rut Inválido
	ErrRUTTaken           = fmt.Err("rut", "registered")            // EN: Rut Registered                   / ES: Rut Registrado
	ErrIPTaken            = fmt.Err("ip", "registered")             // EN: Ip Registered                    / ES: Ip Registrado
)
View Source
var IdentityModel = model.Definition{
	Name: "identity",
	Fields: model.Fields{
		{Name: "id", Type: model.Text(), DB: &model.FieldDB{PK: true}},
		{Name: "user_id", Type: model.Text(), DB: &model.FieldDB{RefColumn: "id"}, Ref: &UserModel},
		{Name: "provider", Type: model.Text()},
		{Name: "provider_id", Type: model.Text()},
		{Name: "email", Type: model.Text()},
		{Name: "created_at", Type: model.Int()},
	},
}
View Source
var Identity_ = struct {
	Id         string
	UserId     string
	Provider   string
	ProviderId string
	Email      string
	CreatedAt  string
}{
	Id:         "id",
	UserId:     "user_id",
	Provider:   "provider",
	ProviderId: "provider_id",
	Email:      "email",
	CreatedAt:  "created_at",
}
View Source
var LANIPModel = model.Definition{
	Name: "lanip",
	Fields: model.Fields{
		{Name: "id", Type: model.Text(), DB: &model.FieldDB{PK: true}},
		{Name: "user_id", Type: model.Text(), DB: &model.FieldDB{RefColumn: "id"}, Ref: &UserModel},
		{Name: "ip", Type: model.Text()},
		{Name: "label", Type: model.Text()},
		{Name: "created_at", Type: model.Int()},
	},
}
View Source
var LANIP_ = struct {
	Id        string
	UserId    string
	Ip        string
	Label     string
	CreatedAt string
}{
	Id:        "id",
	UserId:    "user_id",
	Ip:        "ip",
	Label:     "label",
	CreatedAt: "created_at",
}
View Source
var LoginDataModel = model.Definition{
	Name: "login_data",
	Fields: model.Fields{
		{Name: "email", Type: input.Email(), NotNull: true},
		{Name: "password", Type: input.Password(), NotNull: true},
	},
}
View Source
var OAuthStateModel = model.Definition{
	Name: "oauth_state",
	Fields: model.Fields{
		{Name: "state", Type: model.Text(), DB: &model.FieldDB{PK: true}},
		{Name: "provider", Type: model.Text()},
		{Name: "expires_at", Type: model.Int()},
		{Name: "created_at", Type: model.Int()},
	},
}
View Source
var OAuthState_ = struct {
	State     string
	Provider  string
	ExpiresAt string
	CreatedAt string
}{
	State:     "state",
	Provider:  "provider",
	ExpiresAt: "expires_at",
	CreatedAt: "created_at",
}
View Source
var PasswordDataModel = model.Definition{
	Name: "password_data",
	Fields: model.Fields{
		{Name: "current", Type: input.Password(), NotNull: true},
		{Name: "new", Type: input.Password(), NotNull: true},
		{Name: "confirm", Type: input.Password(), NotNull: true},
	},
}
View Source
var PermissionModel = model.Definition{
	Name: "permission",
	Fields: model.Fields{
		{Name: "id", Type: model.Text(), DB: &model.FieldDB{PK: true}},
		{Name: "name", Type: model.Text()},
		{Name: "resource", Type: model.Text()},
		{Name: "action", Type: model.Text()},
	},
}
View Source
var Permission_ = struct {
	Id       string
	Name     string
	Resource string
	Action   string
}{
	Id:       "id",
	Name:     "name",
	Resource: "resource",
	Action:   "action",
}
View Source
var ProfileDataModel = model.Definition{
	Name: "profile_data",
	Fields: model.Fields{
		{Name: "name", Type: input.Text(), NotNull: true},
		{Name: "phone", Type: input.Phone()},
	},
}
View Source
var RegisterDataModel = model.Definition{
	Name: "register_data",
	Fields: model.Fields{
		{Name: "name", Type: input.Text(), NotNull: true},
		{Name: "email", Type: input.Email(), NotNull: true},
		{Name: "password", Type: input.Password(), NotNull: true},
		{Name: "phone", Type: input.Phone()},
	},
}
View Source
var RoleModel = model.Definition{
	Name: "role",
	Fields: model.Fields{
		{Name: "id", Type: model.Text(), DB: &model.FieldDB{PK: true}},
		{Name: "code", Type: model.Text()},
		{Name: "name", Type: model.Text()},
		{Name: "description", Type: model.Text()},
	},
}
View Source
var RolePermissionModel = model.Definition{
	Name: "role_permission",
	Fields: model.Fields{
		{Name: "role_id", Type: model.Text(), DB: &model.FieldDB{PK: true, RefColumn: "id"}, Ref: &RoleModel},
		{Name: "permission_id", Type: model.Text(), DB: &model.FieldDB{PK: true, RefColumn: "id"}, Ref: &PermissionModel},
	},
}
View Source
var RolePermission_ = struct {
	RoleId       string
	PermissionId string
}{
	RoleId:       "role_id",
	PermissionId: "permission_id",
}
View Source
var Role_ = struct {
	Id          string
	Code        string
	Name        string
	Description string
}{
	Id:          "id",
	Code:        "code",
	Name:        "name",
	Description: "description",
}
View Source
var SessionModel = model.Definition{
	Name: "session",
	Fields: model.Fields{
		{Name: "id", Type: model.Text(), DB: &model.FieldDB{PK: true}},
		{Name: "user_id", Type: model.Text(), DB: &model.FieldDB{RefColumn: "id"}, Ref: &UserModel},
		{Name: "expires_at", Type: model.Int()},
		{Name: "ip", Type: model.Text()},
		{Name: "user_agent", Type: model.Text()},
		{Name: "created_at", Type: model.Int()},
	},
}
View Source
var Session_ = struct {
	Id        string
	UserId    string
	ExpiresAt string
	Ip        string
	UserAgent string
	CreatedAt string
}{
	Id:        "id",
	UserId:    "user_id",
	ExpiresAt: "expires_at",
	Ip:        "ip",
	UserAgent: "user_agent",
	CreatedAt: "created_at",
}
View Source
var UserModel = model.Definition{
	Name: "user",
	Fields: model.Fields{
		{Name: "id", Type: model.Text(), DB: &model.FieldDB{PK: true}},
		{Name: "email", Type: input.Email(), DB: &model.FieldDB{Unique: true}},
		{Name: "name", Type: input.Text()},
		{Name: "phone", Type: input.Phone()},
		{Name: "status", Type: model.Text()},
		{Name: "created_at", Type: model.Int()},
		{Name: "roles", Type: model.StructSlice(&RoleModel), Exclude: true},
		{Name: "permissions", Type: model.StructSlice(&PermissionModel), Exclude: true},
	},
}
View Source
var UserRoleModel = model.Definition{
	Name: "user_role",
	Fields: model.Fields{
		{Name: "user_id", Type: model.Text(), DB: &model.FieldDB{PK: true, RefColumn: "id"}, Ref: &UserModel},
		{Name: "role_id", Type: model.Text(), DB: &model.FieldDB{PK: true, RefColumn: "id"}, Ref: &RoleModel},
	},
}
View Source
var UserRole_ = struct {
	UserId string
	RoleId string
}{
	UserId: "user_id",
	RoleId: "role_id",
}
View Source
var User_ = struct {
	Id          string
	Email       string
	Name        string
	Phone       string
	Status      string
	CreatedAt   string
	Roles       string
	Permissions string
}{
	Id:          "id",
	Email:       "email",
	Name:        "name",
	Phone:       "phone",
	Status:      "status",
	CreatedAt:   "created_at",
	Roles:       "roles",
	Permissions: "permissions",
}

Functions

func ClientIP added in v0.2.0

func ClientIP(ctx router.Context, trustProxy bool) string

ClientIP extracts the caller's IP from ctx. When trustProxy is true it reads X-Forwarded-For / X-Real-IP first (only safe behind a reverse proxy you control — otherwise a client can spoof its own IP). Shared by every mode/strategy that needs an IP for a SecurityEvent or an audit column: it is mechanism-agnostic, so it lives at the root, not inside any one mode.

func NewView added in v0.1.0

func NewView(caller router.Caller) view.Presenter

NewView builds the user-administration Presenter — the tech-agnostic engine a renderer (crudview, or any other) wraps. The app decides which renderer draws it.

Types

type Authenticator added in v0.1.0

type Authenticator interface {
	Name() string
	Mount(r router.Router)
}

Authenticator is one login mode. It owns its HTTP routes completely — authority never inspects, duplicates, or knows the shape of what it mounts.

type Config added in v0.0.2

type Config struct {
	// CookieName/TokenTTL configure authority's OWN default session strategy
	// (session/cookie) and the lifetime of every session row it creates,
	// regardless of which strategy ends up carrying the credential.
	CookieName string // default: "session"
	TokenTTL   int    // default: 86400 (seconds)

	// TrustProxy tells every IP-extracting collaborator (the default cookie
	// strategy, Module.LoginLAN) whether to trust X-Forwarded-For/X-Real-IP.
	// The composition root passes this SAME value to any mode it constructs
	// that also needs it (trusted_ip.New's trustProxy param, WithTrustProxy on
	// the others) — one environmental fact, told explicitly to every consumer,
	// same idiom as IDs/Events.
	TrustProxy bool

	// IDs mints primary keys for every record this module creates. REQUIRED:
	// New fails if nil — an auth module must never silently pick its own
	// generator.
	IDs model.IDGenerator

	// Events receives security events (TopicSecurity). Optional: nil = events
	// are dropped (fire-and-forget contract), never an error.
	Events events.Publisher

	// OnPasswordValidate is consulted by Module.SetPassword before hashing.
	// Return a non-nil error to reject the password. nil = only the built-in
	// len>=8 check applies.
	OnPasswordValidate func(password string) error
}

type Identity added in v0.0.2

type Identity struct {
	Id         string
	UserId     string
	Provider   string
	ProviderId string
	Email      string
	CreatedAt  int64
}

func ReadOneIdentity added in v0.0.6

func ReadOneIdentity(qb *orm.QB, model *Identity) (*Identity, error)

func (*Identity) DecodeFields added in v0.0.29

func (m *Identity) DecodeFields(r model.FieldReader)

func (*Identity) EncodeFields added in v0.0.29

func (m *Identity) EncodeFields(w model.FieldWriter)

func (*Identity) IsNil added in v0.0.29

func (m *Identity) IsNil() bool

func (*Identity) ModelName added in v0.0.29

func (m *Identity) ModelName() string

func (*Identity) Pointers added in v0.0.6

func (m *Identity) Pointers() []any

func (*Identity) Schema added in v0.0.6

func (m *Identity) Schema() []model.Field

func (*Identity) SchemaExt added in v0.0.30

func (m *Identity) SchemaExt() []model.FieldExt

func (*Identity) Validate added in v0.0.32

func (m *Identity) Validate(action byte) error

type IdentityList added in v0.0.29

type IdentityList []*Identity

func ReadAllIdentity added in v0.0.6

func ReadAllIdentity(qb *orm.QB) (IdentityList, error)

func (*IdentityList) Append added in v0.0.29

func (s *IdentityList) Append() model.Fielder

func (*IdentityList) At added in v0.0.29

func (s *IdentityList) At(i int) model.Fielder

func (*IdentityList) DecodeFields added in v0.0.29

func (s *IdentityList) DecodeFields(_ model.FieldReader)

func (*IdentityList) EncodeFields added in v0.0.29

func (s *IdentityList) EncodeFields(_ model.FieldWriter)

func (*IdentityList) IsNil added in v0.0.29

func (s *IdentityList) IsNil() bool

func (*IdentityList) Len added in v0.0.29

func (s *IdentityList) Len() int

func (*IdentityList) Pointers added in v0.0.29

func (s *IdentityList) Pointers() []any

func (*IdentityList) Schema added in v0.0.29

func (s *IdentityList) Schema() []model.Field

type IdentityStore added in v0.2.0

type IdentityStore interface {
	UserByID(id string) (User, error)
	UserByEmail(email string) (User, error)
	CreateUser(email, name, phone string) (User, error)
	// IdentityByProvider finds who owns a (provider, providerID) pair — an OAuth
	// (provider name, external subject) or a trusted_ip (provider="trusted_ip",
	// the normalized RUT).
	IdentityByProvider(provider, providerID string) (Identity, error)
	// IdentityFor returns userID's identity row for provider — e.g. email_password
	// reads its bcrypt hash from Identity.ProviderId here.
	IdentityFor(userID, provider string) (Identity, error)
	UpsertIdentity(userID, provider, providerID, email string) error
}

IdentityStore is the persistence port a mode uses to resolve or register the domain User/Identity behind a credential. A mode never queries *orm.DB itself.

type LANIP added in v0.0.2

type LANIP struct {
	Id        string
	UserId    string
	Ip        string
	Label     string
	CreatedAt int64
}

func ReadOneLANIP added in v0.0.6

func ReadOneLANIP(qb *orm.QB, model *LANIP) (*LANIP, error)

func (*LANIP) DecodeFields added in v0.0.29

func (m *LANIP) DecodeFields(r model.FieldReader)

func (*LANIP) EncodeFields added in v0.0.29

func (m *LANIP) EncodeFields(w model.FieldWriter)

func (*LANIP) IsNil added in v0.0.29

func (m *LANIP) IsNil() bool

func (*LANIP) ModelName added in v0.0.29

func (m *LANIP) ModelName() string

func (*LANIP) Pointers added in v0.0.6

func (m *LANIP) Pointers() []any

func (*LANIP) Schema added in v0.0.6

func (m *LANIP) Schema() []model.Field

func (*LANIP) SchemaExt added in v0.0.30

func (m *LANIP) SchemaExt() []model.FieldExt

func (*LANIP) Validate added in v0.0.32

func (m *LANIP) Validate(action byte) error

type LANIPList added in v0.0.29

type LANIPList []*LANIP

func ReadAllLANIP added in v0.0.6

func ReadAllLANIP(qb *orm.QB) (LANIPList, error)

func (*LANIPList) Append added in v0.0.29

func (s *LANIPList) Append() model.Fielder

func (*LANIPList) At added in v0.0.29

func (s *LANIPList) At(i int) model.Fielder

func (*LANIPList) DecodeFields added in v0.0.29

func (s *LANIPList) DecodeFields(_ model.FieldReader)

func (*LANIPList) EncodeFields added in v0.0.29

func (s *LANIPList) EncodeFields(_ model.FieldWriter)

func (*LANIPList) IsNil added in v0.0.29

func (s *LANIPList) IsNil() bool

func (*LANIPList) Len added in v0.0.29

func (s *LANIPList) Len() int

func (*LANIPList) Pointers added in v0.0.29

func (s *LANIPList) Pointers() []any

func (*LANIPList) Schema added in v0.0.29

func (s *LANIPList) Schema() []model.Field

type LoginData added in v0.0.2

type LoginData struct {
	Email    string
	Password string
}

func (*LoginData) DecodeFields added in v0.0.29

func (m *LoginData) DecodeFields(r model.FieldReader)

func (*LoginData) EncodeFields added in v0.0.29

func (m *LoginData) EncodeFields(w model.FieldWriter)

func (*LoginData) IsNil added in v0.0.29

func (m *LoginData) IsNil() bool

func (*LoginData) ModelName added in v0.0.29

func (m *LoginData) ModelName() string

func (*LoginData) Pointers added in v0.0.28

func (m *LoginData) Pointers() []any

func (*LoginData) Schema added in v0.0.28

func (m *LoginData) Schema() []model.Field

func (*LoginData) Validate added in v0.0.32

func (m *LoginData) Validate(action byte) error

type LoginDataList added in v0.0.29

type LoginDataList []*LoginData

func (*LoginDataList) Append added in v0.0.29

func (s *LoginDataList) Append() model.Fielder

func (*LoginDataList) At added in v0.0.29

func (s *LoginDataList) At(i int) model.Fielder

func (*LoginDataList) DecodeFields added in v0.0.29

func (s *LoginDataList) DecodeFields(_ model.FieldReader)

func (*LoginDataList) EncodeFields added in v0.0.29

func (s *LoginDataList) EncodeFields(_ model.FieldWriter)

func (*LoginDataList) IsNil added in v0.0.29

func (s *LoginDataList) IsNil() bool

func (*LoginDataList) Len added in v0.0.29

func (s *LoginDataList) Len() int

func (*LoginDataList) Pointers added in v0.0.29

func (s *LoginDataList) Pointers() []any

func (*LoginDataList) Schema added in v0.0.29

func (s *LoginDataList) Schema() []model.Field

type OAuthConfig added in v0.0.34

type OAuthConfig struct {
	ClientID     string
	ClientSecret string
	RedirectURL  string
	Scopes       []string
	AuthURL      string // provider's authorization endpoint
	TokenURL     string // provider's token endpoint
}

OAuthConfig is the provider's registration: what the app declares in the provider console.

type OAuthProvider added in v0.0.2

type OAuthProvider interface {
	Name() string
	AuthCodeURL(state string) string
	ExchangeCode(code string) (OAuthToken, error)
	GetUserInfo(token OAuthToken) (OAuthUserInfo, error)
}

type OAuthState added in v0.0.6

type OAuthState struct {
	State     string
	Provider  string
	ExpiresAt int64
	CreatedAt int64
}

func ReadOneOAuthState added in v0.0.6

func ReadOneOAuthState(qb *orm.QB, model *OAuthState) (*OAuthState, error)

func (*OAuthState) DecodeFields added in v0.0.29

func (m *OAuthState) DecodeFields(r model.FieldReader)

func (*OAuthState) EncodeFields added in v0.0.29

func (m *OAuthState) EncodeFields(w model.FieldWriter)

func (*OAuthState) IsNil added in v0.0.29

func (m *OAuthState) IsNil() bool

func (*OAuthState) ModelName added in v0.0.29

func (m *OAuthState) ModelName() string

func (*OAuthState) Pointers added in v0.0.6

func (m *OAuthState) Pointers() []any

func (*OAuthState) Schema added in v0.0.6

func (m *OAuthState) Schema() []model.Field

func (*OAuthState) Validate added in v0.0.32

func (m *OAuthState) Validate(action byte) error

type OAuthStateList added in v0.0.29

type OAuthStateList []*OAuthState

func ReadAllOAuthState added in v0.0.6

func ReadAllOAuthState(qb *orm.QB) (OAuthStateList, error)

func (*OAuthStateList) Append added in v0.0.29

func (s *OAuthStateList) Append() model.Fielder

func (*OAuthStateList) At added in v0.0.29

func (s *OAuthStateList) At(i int) model.Fielder

func (*OAuthStateList) DecodeFields added in v0.0.29

func (s *OAuthStateList) DecodeFields(_ model.FieldReader)

func (*OAuthStateList) EncodeFields added in v0.0.29

func (s *OAuthStateList) EncodeFields(_ model.FieldWriter)

func (*OAuthStateList) IsNil added in v0.0.29

func (s *OAuthStateList) IsNil() bool

func (*OAuthStateList) Len added in v0.0.29

func (s *OAuthStateList) Len() int

func (*OAuthStateList) Pointers added in v0.0.29

func (s *OAuthStateList) Pointers() []any

func (*OAuthStateList) Schema added in v0.0.29

func (s *OAuthStateList) Schema() []model.Field

type OAuthToken added in v0.0.34

type OAuthToken struct {
	AccessToken string
	TokenType   string
	ExpiresIn   int
}

OAuthToken is what a provider returns when it exchanges the code. It replaces oauth2.Token: that type dragged net/http in, and net/http does not exist under TinyGo — which put this whole module out of the edge for one function call.

func (*OAuthToken) DecodeFields added in v0.0.34

func (t *OAuthToken) DecodeFields(r model.FieldReader)

func (OAuthToken) IsNil added in v0.0.34

func (t OAuthToken) IsNil() bool

type OAuthUserInfo added in v0.0.2

type OAuthUserInfo struct {
	ID    string
	Email string
	Name  string
}

type PasswordData added in v0.0.2

type PasswordData struct {
	Current string
	New     string
	Confirm string
}

func (*PasswordData) DecodeFields added in v0.0.29

func (m *PasswordData) DecodeFields(r model.FieldReader)

func (*PasswordData) EncodeFields added in v0.0.29

func (m *PasswordData) EncodeFields(w model.FieldWriter)

func (*PasswordData) IsNil added in v0.0.29

func (m *PasswordData) IsNil() bool

func (*PasswordData) ModelName added in v0.0.29

func (m *PasswordData) ModelName() string

func (*PasswordData) Pointers added in v0.0.28

func (m *PasswordData) Pointers() []any

func (*PasswordData) Schema added in v0.0.28

func (m *PasswordData) Schema() []model.Field

func (*PasswordData) Validate added in v0.0.32

func (m *PasswordData) Validate(action byte) error

type PasswordDataList added in v0.0.29

type PasswordDataList []*PasswordData

func (*PasswordDataList) Append added in v0.0.29

func (s *PasswordDataList) Append() model.Fielder

func (*PasswordDataList) At added in v0.0.29

func (s *PasswordDataList) At(i int) model.Fielder

func (*PasswordDataList) DecodeFields added in v0.0.29

func (s *PasswordDataList) DecodeFields(_ model.FieldReader)

func (*PasswordDataList) EncodeFields added in v0.0.29

func (s *PasswordDataList) EncodeFields(_ model.FieldWriter)

func (*PasswordDataList) IsNil added in v0.0.29

func (s *PasswordDataList) IsNil() bool

func (*PasswordDataList) Len added in v0.0.29

func (s *PasswordDataList) Len() int

func (*PasswordDataList) Pointers added in v0.0.29

func (s *PasswordDataList) Pointers() []any

func (*PasswordDataList) Schema added in v0.0.29

func (s *PasswordDataList) Schema() []model.Field

type Permission added in v0.0.6

type Permission struct {
	Id       string
	Name     string
	Resource string
	Action   string
}

func ReadOnePermission added in v0.0.6

func ReadOnePermission(qb *orm.QB, model *Permission) (*Permission, error)

func (*Permission) DecodeFields added in v0.0.29

func (m *Permission) DecodeFields(r model.FieldReader)

func (*Permission) EncodeFields added in v0.0.29

func (m *Permission) EncodeFields(w model.FieldWriter)

func (*Permission) IsNil added in v0.0.29

func (m *Permission) IsNil() bool

func (*Permission) ModelName added in v0.0.29

func (m *Permission) ModelName() string

func (*Permission) Pointers added in v0.0.6

func (m *Permission) Pointers() []any

func (*Permission) Schema added in v0.0.6

func (m *Permission) Schema() []model.Field

func (*Permission) Validate added in v0.0.32

func (m *Permission) Validate(action byte) error

type PermissionList added in v0.0.29

type PermissionList []*Permission

func ReadAllPermission added in v0.0.6

func ReadAllPermission(qb *orm.QB) (PermissionList, error)

func (*PermissionList) Append added in v0.0.29

func (s *PermissionList) Append() model.Fielder

func (*PermissionList) At added in v0.0.29

func (s *PermissionList) At(i int) model.Fielder

func (*PermissionList) DecodeFields added in v0.0.29

func (s *PermissionList) DecodeFields(_ model.FieldReader)

func (*PermissionList) EncodeFields added in v0.0.29

func (s *PermissionList) EncodeFields(_ model.FieldWriter)

func (*PermissionList) IsNil added in v0.0.29

func (s *PermissionList) IsNil() bool

func (*PermissionList) Len added in v0.0.29

func (s *PermissionList) Len() int

func (*PermissionList) Pointers added in v0.0.29

func (s *PermissionList) Pointers() []any

func (*PermissionList) Schema added in v0.0.29

func (s *PermissionList) Schema() []model.Field

type ProfileDTO added in v0.0.30

type ProfileDTO struct {
	Id          string
	Name        string
	Email       string
	Avatar      string
	Roles       []string
	Permissions []string // "resource:actions" pairs, e.g. "service_catalog:rc"
	Locale      string
}

ProfileDTO is a safe subset of User data for public/API consumption.

func (*ProfileDTO) DecodeFields added in v0.0.30

func (p *ProfileDTO) DecodeFields(r model.FieldReader)

func (ProfileDTO) EncodeFields added in v0.0.30

func (p ProfileDTO) EncodeFields(w model.FieldWriter)

func (ProfileDTO) IsNil added in v0.0.30

func (p ProfileDTO) IsNil() bool

type ProfileData added in v0.0.2

type ProfileData struct {
	Name  string
	Phone string
}

func (*ProfileData) DecodeFields added in v0.0.29

func (m *ProfileData) DecodeFields(r model.FieldReader)

func (*ProfileData) EncodeFields added in v0.0.29

func (m *ProfileData) EncodeFields(w model.FieldWriter)

func (*ProfileData) IsNil added in v0.0.29

func (m *ProfileData) IsNil() bool

func (*ProfileData) ModelName added in v0.0.29

func (m *ProfileData) ModelName() string

func (*ProfileData) Pointers added in v0.0.28

func (m *ProfileData) Pointers() []any

func (*ProfileData) Schema added in v0.0.28

func (m *ProfileData) Schema() []model.Field

func (*ProfileData) Validate added in v0.0.32

func (m *ProfileData) Validate(action byte) error

type ProfileDataList added in v0.0.29

type ProfileDataList []*ProfileData

func (*ProfileDataList) Append added in v0.0.29

func (s *ProfileDataList) Append() model.Fielder

func (*ProfileDataList) At added in v0.0.29

func (s *ProfileDataList) At(i int) model.Fielder

func (*ProfileDataList) DecodeFields added in v0.0.29

func (s *ProfileDataList) DecodeFields(_ model.FieldReader)

func (*ProfileDataList) EncodeFields added in v0.0.29

func (s *ProfileDataList) EncodeFields(_ model.FieldWriter)

func (*ProfileDataList) IsNil added in v0.0.29

func (s *ProfileDataList) IsNil() bool

func (*ProfileDataList) Len added in v0.0.29

func (s *ProfileDataList) Len() int

func (*ProfileDataList) Pointers added in v0.0.29

func (s *ProfileDataList) Pointers() []any

func (*ProfileDataList) Schema added in v0.0.29

func (s *ProfileDataList) Schema() []model.Field

type RegisterData added in v0.0.2

type RegisterData struct {
	Name     string
	Email    string
	Password string
	Phone    string
}

func (*RegisterData) DecodeFields added in v0.0.29

func (m *RegisterData) DecodeFields(r model.FieldReader)

func (*RegisterData) EncodeFields added in v0.0.29

func (m *RegisterData) EncodeFields(w model.FieldWriter)

func (*RegisterData) IsNil added in v0.0.29

func (m *RegisterData) IsNil() bool

func (*RegisterData) ModelName added in v0.0.29

func (m *RegisterData) ModelName() string

func (*RegisterData) Pointers added in v0.0.28

func (m *RegisterData) Pointers() []any

func (*RegisterData) Schema added in v0.0.28

func (m *RegisterData) Schema() []model.Field

func (*RegisterData) Validate added in v0.0.32

func (m *RegisterData) Validate(action byte) error

type RegisterDataList added in v0.0.29

type RegisterDataList []*RegisterData

func (*RegisterDataList) Append added in v0.0.29

func (s *RegisterDataList) Append() model.Fielder

func (*RegisterDataList) At added in v0.0.29

func (s *RegisterDataList) At(i int) model.Fielder

func (*RegisterDataList) DecodeFields added in v0.0.29

func (s *RegisterDataList) DecodeFields(_ model.FieldReader)

func (*RegisterDataList) EncodeFields added in v0.0.29

func (s *RegisterDataList) EncodeFields(_ model.FieldWriter)

func (*RegisterDataList) IsNil added in v0.0.29

func (s *RegisterDataList) IsNil() bool

func (*RegisterDataList) Len added in v0.0.29

func (s *RegisterDataList) Len() int

func (*RegisterDataList) Pointers added in v0.0.29

func (s *RegisterDataList) Pointers() []any

func (*RegisterDataList) Schema added in v0.0.29

func (s *RegisterDataList) Schema() []model.Field

type Role added in v0.0.6

type Role struct {
	Id          string
	Code        string
	Name        string
	Description string
}

func ReadOneRole added in v0.0.6

func ReadOneRole(qb *orm.QB, model *Role) (*Role, error)

func (*Role) DecodeFields added in v0.0.29

func (m *Role) DecodeFields(r model.FieldReader)

func (*Role) EncodeFields added in v0.0.29

func (m *Role) EncodeFields(w model.FieldWriter)

func (*Role) IsNil added in v0.0.29

func (m *Role) IsNil() bool

func (*Role) ModelName added in v0.0.29

func (m *Role) ModelName() string

func (*Role) Pointers added in v0.0.6

func (m *Role) Pointers() []any

func (*Role) Schema added in v0.0.6

func (m *Role) Schema() []model.Field

func (*Role) Validate added in v0.0.32

func (m *Role) Validate(action byte) error

type RoleList added in v0.0.29

type RoleList []*Role

func ReadAllRole added in v0.0.6

func ReadAllRole(qb *orm.QB) (RoleList, error)

func (*RoleList) Append added in v0.0.29

func (s *RoleList) Append() model.Fielder

func (*RoleList) At added in v0.0.29

func (s *RoleList) At(i int) model.Fielder

func (*RoleList) DecodeFields added in v0.0.29

func (s *RoleList) DecodeFields(_ model.FieldReader)

func (*RoleList) EncodeFields added in v0.0.29

func (s *RoleList) EncodeFields(_ model.FieldWriter)

func (*RoleList) IsNil added in v0.0.29

func (s *RoleList) IsNil() bool

func (*RoleList) Len added in v0.0.29

func (s *RoleList) Len() int

func (*RoleList) Pointers added in v0.0.29

func (s *RoleList) Pointers() []any

func (*RoleList) Schema added in v0.0.29

func (s *RoleList) Schema() []model.Field

type RolePermission added in v0.0.6

type RolePermission struct {
	RoleId       string
	PermissionId string
}

func ReadOneRolePermission added in v0.0.6

func ReadOneRolePermission(qb *orm.QB, model *RolePermission) (*RolePermission, error)

func (*RolePermission) DecodeFields added in v0.0.29

func (m *RolePermission) DecodeFields(r model.FieldReader)

func (*RolePermission) EncodeFields added in v0.0.29

func (m *RolePermission) EncodeFields(w model.FieldWriter)

func (*RolePermission) IsNil added in v0.0.29

func (m *RolePermission) IsNil() bool

func (*RolePermission) ModelName added in v0.0.29

func (m *RolePermission) ModelName() string

func (*RolePermission) Pointers added in v0.0.6

func (m *RolePermission) Pointers() []any

func (*RolePermission) Schema added in v0.0.6

func (m *RolePermission) Schema() []model.Field

func (*RolePermission) SchemaExt added in v0.0.30

func (m *RolePermission) SchemaExt() []model.FieldExt

func (*RolePermission) Validate added in v0.0.32

func (m *RolePermission) Validate(action byte) error

type RolePermissionList added in v0.0.29

type RolePermissionList []*RolePermission

func ReadAllRolePermission added in v0.0.6

func ReadAllRolePermission(qb *orm.QB) (RolePermissionList, error)

func (*RolePermissionList) Append added in v0.0.29

func (s *RolePermissionList) Append() model.Fielder

func (*RolePermissionList) At added in v0.0.29

func (*RolePermissionList) DecodeFields added in v0.0.29

func (s *RolePermissionList) DecodeFields(_ model.FieldReader)

func (*RolePermissionList) EncodeFields added in v0.0.29

func (s *RolePermissionList) EncodeFields(_ model.FieldWriter)

func (*RolePermissionList) IsNil added in v0.0.29

func (s *RolePermissionList) IsNil() bool

func (*RolePermissionList) Len added in v0.0.29

func (s *RolePermissionList) Len() int

func (*RolePermissionList) Pointers added in v0.0.29

func (s *RolePermissionList) Pointers() []any

func (*RolePermissionList) Schema added in v0.0.29

func (s *RolePermissionList) Schema() []model.Field

type SecurityEvent added in v0.0.22

type SecurityEvent struct {
	Type      SecurityEventType
	IP        string // client IP, empty if not available
	UserID    string // empty if user not yet identified
	Provider  string // OAuth provider name, for OAuth events
	Resource  string // RBAC resource, for EventAccessDenied
	Timestamp int64  // time.Now().Unix()
}

func (*SecurityEvent) EncodeFields added in v0.1.0

func (e *SecurityEvent) EncodeFields(w model.FieldWriter)

func (*SecurityEvent) IsNil added in v0.1.0

func (e *SecurityEvent) IsNil() bool

type SecurityEventType added in v0.0.22

type SecurityEventType uint8
const (
	EventJWTTampered        SecurityEventType = iota // validateJWT: jwt.Forged (never jwt.Expired)
	EventOAuthReplay                                 // consumeState: state already consumed (2nd use)
	EventOAuthExpiredState                           // consumeState: state found but past ExpiresAt
	EventOAuthCrossProvider                          // consumeState: provider mismatch (state preserved)
	EventIPMismatch                                  // LoginLAN: IP not registered
	EventNonActiveAccess                             // Login/LoginLAN: status != "active"
	EventUnauthorizedAccess                          // validateSession: cookie present but session invalid
	EventAccessDenied                                // AccessCheck: RBAC denied with valid session
	EventPermissionCorrupt                           // HasPermission: permissions.action is not a CRUD string
	EventRateLimited                                 // POST /login: Config.RateLimit rejected the attempt before bcrypt
)

type SecurityNotifier added in v0.2.0

type SecurityNotifier interface {
	Notify(e SecurityEvent)
}

SecurityNotifier lets a mode report a SecurityEvent without knowing whether anything is subscribed.

type Session added in v0.0.2

type Session struct {
	Id        string
	UserId    string
	ExpiresAt int64
	Ip        string
	UserAgent string
	CreatedAt int64
}

func ReadOneSession added in v0.0.6

func ReadOneSession(qb *orm.QB, model *Session) (*Session, error)

func (*Session) DecodeFields added in v0.0.29

func (m *Session) DecodeFields(r model.FieldReader)

func (*Session) EncodeFields added in v0.0.29

func (m *Session) EncodeFields(w model.FieldWriter)

func (*Session) IsNil added in v0.0.29

func (m *Session) IsNil() bool

func (*Session) ModelName added in v0.0.29

func (m *Session) ModelName() string

func (*Session) Pointers added in v0.0.6

func (m *Session) Pointers() []any

func (*Session) Schema added in v0.0.6

func (m *Session) Schema() []model.Field

func (*Session) SchemaExt added in v0.0.30

func (m *Session) SchemaExt() []model.FieldExt

func (*Session) Validate added in v0.0.32

func (m *Session) Validate(action byte) error

type SessionIssuer added in v0.2.0

type SessionIssuer interface {
	IssueSession(ctx router.Context, userID string) error
}

SessionIssuer lets a mode start a session after verifying credentials, without knowing whether the app carries it in a cookie or a signed JWT.

type SessionList added in v0.0.29

type SessionList []*Session

func ReadAllSession added in v0.0.6

func ReadAllSession(qb *orm.QB) (SessionList, error)

func (*SessionList) Append added in v0.0.29

func (s *SessionList) Append() model.Fielder

func (*SessionList) At added in v0.0.29

func (s *SessionList) At(i int) model.Fielder

func (*SessionList) DecodeFields added in v0.0.29

func (s *SessionList) DecodeFields(_ model.FieldReader)

func (*SessionList) EncodeFields added in v0.0.29

func (s *SessionList) EncodeFields(_ model.FieldWriter)

func (*SessionList) IsNil added in v0.0.29

func (s *SessionList) IsNil() bool

func (*SessionList) Len added in v0.0.29

func (s *SessionList) Len() int

func (*SessionList) Pointers added in v0.0.29

func (s *SessionList) Pointers() []any

func (*SessionList) Schema added in v0.0.29

func (s *SessionList) Schema() []model.Field

type SessionRepo added in v0.2.0

type SessionRepo interface {
	CreateSession(userID, ip, userAgent string) (Session, error)
	GetSession(id string) (Session, error)
	DeleteSession(id string) error
}

SessionRepo is the storage port a SessionStrategy uses to persist stateful sessions. authority.Module implements it with its own table + cache.

type SessionStrategy added in v0.2.0

type SessionStrategy interface {
	Issue(ctx router.Context, userID string) error          // starts a session, writes the credential onto ctx's response
	Identify(ctx router.Context) (userID string, err error) // reads the incoming credential; "" only alongside a non-nil err
	Revoke(ctx router.Context) error                        // ends the session named by ctx's incoming credential
}

SessionStrategy is how identity survives across requests after a successful login. authority holds exactly one (default: session/cookie); the consumer may swap it via Module.SetStrategy before mounting. Implementations: session/cookie, session/jwt.

type StateStore added in v0.2.0

type StateStore interface {
	CreateState(provider string) (state string, err error)
	ConsumeState(state, provider string) error // single-use: deletes on read, validates provider+expiry
}

StateStore is the anti-CSRF port the oauth2 mode uses for its one-time state token. authority owns the oauth_state table; a mode never touches it directly.

type TrustedIPStore added in v0.2.0

type TrustedIPStore interface {
	IsTrustedIP(userID, ip string) bool
}

TrustedIPStore is the read-only port the trusted_ip mode uses to check whether a request's IP is on userID's allowlist. Kept separate from IdentityStore because an allowed IP is not a login credential — it's an authorization check applied AFTER the RUT already identified the user.

type User

type User struct {
	Id          string
	Email       string
	Name        string
	Phone       string
	Status      string
	CreatedAt   int64
	Roles       []Role
	Permissions []Permission
}

func ReadOneUser added in v0.0.6

func ReadOneUser(qb *orm.QB, model *User) (*User, error)

func (*User) DecodeFields added in v0.0.29

func (m *User) DecodeFields(r model.FieldReader)

func (*User) EncodeFields added in v0.0.29

func (m *User) EncodeFields(w model.FieldWriter)

func (*User) IsNil added in v0.0.29

func (m *User) IsNil() bool

func (*User) Item added in v0.1.0

func (m *User) Item() view.Item

Item projects a User as a list row (view.Itemizer) — the ONLY view-specific code this module writes on its model.

func (*User) ModelName added in v0.0.29

func (m *User) ModelName() string

func (*User) Pointers added in v0.0.6

func (m *User) Pointers() []any

func (*User) Schema added in v0.0.6

func (m *User) Schema() []model.Field

func (*User) Validate added in v0.0.32

func (m *User) Validate(action byte) error

type UserList added in v0.0.29

type UserList []*User

func ReadAllUser added in v0.0.6

func ReadAllUser(qb *orm.QB) (UserList, error)

func (*UserList) Append added in v0.0.29

func (s *UserList) Append() model.Fielder

func (*UserList) At added in v0.0.29

func (s *UserList) At(i int) model.Fielder

func (*UserList) DecodeFields added in v0.0.29

func (s *UserList) DecodeFields(_ model.FieldReader)

func (*UserList) EncodeFields added in v0.0.29

func (s *UserList) EncodeFields(_ model.FieldWriter)

func (*UserList) IsNil added in v0.0.29

func (s *UserList) IsNil() bool

func (*UserList) Len added in v0.0.29

func (s *UserList) Len() int

func (*UserList) Pointers added in v0.0.29

func (s *UserList) Pointers() []any

func (*UserList) Schema added in v0.0.29

func (s *UserList) Schema() []model.Field

type UserRole added in v0.0.6

type UserRole struct {
	UserId string
	RoleId string
}

func ReadOneUserRole added in v0.0.6

func ReadOneUserRole(qb *orm.QB, model *UserRole) (*UserRole, error)

func (*UserRole) DecodeFields added in v0.0.29

func (m *UserRole) DecodeFields(r model.FieldReader)

func (*UserRole) EncodeFields added in v0.0.29

func (m *UserRole) EncodeFields(w model.FieldWriter)

func (*UserRole) IsNil added in v0.0.29

func (m *UserRole) IsNil() bool

func (*UserRole) ModelName added in v0.0.29

func (m *UserRole) ModelName() string

func (*UserRole) Pointers added in v0.0.6

func (m *UserRole) Pointers() []any

func (*UserRole) Schema added in v0.0.6

func (m *UserRole) Schema() []model.Field

func (*UserRole) SchemaExt added in v0.0.30

func (m *UserRole) SchemaExt() []model.FieldExt

func (*UserRole) Validate added in v0.0.32

func (m *UserRole) Validate(action byte) error

type UserRoleList added in v0.0.29

type UserRoleList []*UserRole

func ReadAllUserRole added in v0.0.6

func ReadAllUserRole(qb *orm.QB) (UserRoleList, error)

func (*UserRoleList) Append added in v0.0.29

func (s *UserRoleList) Append() model.Fielder

func (*UserRoleList) At added in v0.0.29

func (s *UserRoleList) At(i int) model.Fielder

func (*UserRoleList) DecodeFields added in v0.0.29

func (s *UserRoleList) DecodeFields(_ model.FieldReader)

func (*UserRoleList) EncodeFields added in v0.0.29

func (s *UserRoleList) EncodeFields(_ model.FieldWriter)

func (*UserRoleList) IsNil added in v0.0.29

func (s *UserRoleList) IsNil() bool

func (*UserRoleList) Len added in v0.0.29

func (s *UserRoleList) Len() int

func (*UserRoleList) Pointers added in v0.0.29

func (s *UserRoleList) Pointers() []any

func (*UserRoleList) Schema added in v0.0.29

func (s *UserRoleList) Schema() []model.Field

Directories

Path Synopsis
session
jwt

Jump to

Keyboard shortcuts

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