valueobject

package
v0.2.14 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPassword

func CheckPassword(hash, password, salt []byte) error

CheckPassword compares the hash with the salted password. A nil return means the password is correct, but an error could mean either the password is not correct, or the salt process failed - indicated in logs

func FmtBytes

func FmtBytes(size float64) string

FmtBytes converts the numeric byte size value to the appropriate magnitude size in KB, MB, GB, TB, PB, or EB.

func FmtTime

func FmtTime(t int64) string

FmtTime shows a human readable time based on the timestamp

func HashPassword

func HashPassword(password, salt []byte) ([]byte, error)

HashPassword encrypts the salted password using bcrypt

func NewEtag

func NewEtag() string

NewEtag generates a new Etag for response caching

func RandSalt

func RandSalt() ([]byte, error)

RandSalt generates 16 * 8 bits of data for a random salt

Types

type Config

type Config struct {
	contentVO.Item

	Name                    string   `json:"name"`
	Domain                  string   `json:"domain"`
	Netlify                 string   `json:"netlify"`
	BindAddress             string   `json:"bind_addr"`
	HTTPPort                string   `json:"http_port"`
	HTTPSPort               string   `json:"https_port"`
	DevHTTPSPort            string   `json:"dev_https_port"`
	AdminEmail              string   `json:"admin_email"`
	ClientSecret            string   `json:"client_secret"`
	Etag                    string   `json:"etag"`
	DisableCORS             bool     `json:"cors_disabled"`
	DisableGZIP             bool     `json:"gzip_disabled"`
	DisableHTTPCache        bool     `json:"cache_disabled"`
	CacheMaxAge             int64    `json:"cache_max_age"`
	CacheInvalidate         []string `json:"cache"`
	BackupBasicAuthUser     string   `json:"backup_basic_auth_user"`
	BackupBasicAuthPassword string   `json:"backup_basic_auth_password"`

	// CouchDB 配置
	URL       string `json:"url"`        // CouchDB 服务器地址 (如 http://localhost:5984)
	AdminUser string `json:"admin_user"` // 管理员用户名
	AdminPass string `json:"admin_pass"` // 管理员密码
	DBPrefix  string `json:"db_prefix"`  // 用户数据库前缀 (如 userdb-)

	// Caddy 配置
	CaddyHost string `json:"caddy_host"` // Caddy 服务器地址 (如 localhost)
	CaddyPort string `json:"caddy_port"` // Caddy 服务器端口 (如 8080)

	// 服务器 IP 配置
	ServerIP string `json:"server_ip"` // 服务器公网 IP (用于域名检测)
}

func (*Config) Convert

func (c *Config) Convert(data url.Values) (*Config, error)

func (*Config) IsCacheInvalidate

func (c *Config) IsCacheInvalidate() bool

func (*Config) Marshal

func (c *Config) Marshal() ([]byte, error)

func (*Config) MarshalEditor

func (c *Config) MarshalEditor() ([]byte, error)

MarshalEditor writes a buffer of html to edit a Post and partially implements editor.Editable

func (*Config) Update

func (c *Config) Update(key string, value any) (*Config, error)

type FileUpload

type FileUpload struct {
	contentVO.Item

	Name          string `json:"name"`
	Path          string `json:"path"`
	ContentLength int64  `json:"content_length"`
	ContentType   string `json:"content_type"`
}

FileUpload represents the file uploaded to the system

func (*FileUpload) FilePath

func (f *FileUpload) FilePath() string

func (*FileUpload) MarshalEditor

func (f *FileUpload) MarshalEditor() ([]byte, error)

MarshalEditor writes a buffer of html to edit a Post and partially implements editor.Editable

func (*FileUpload) Push

func (f *FileUpload) Push() []string

func (*FileUpload) String

func (f *FileUpload) String() string

String partially implements item.Identifiable and overrides Item's String()

type User

type User struct {
	Id    uint64 `json:"id"`
	Email string `json:"email"`
	Hash  string `json:"hash"`
	Salt  string `json:"salt"`
}

func (*User) ID

func (u *User) ID() uint64

func (*User) Name

func (u *User) Name() string

Jump to

Keyboard shortcuts

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