auth

package
v0.0.0-...-222817c Latest Latest
Warning

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

Go to latest
Published: May 28, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckKeyRecord

func CheckKeyRecord(keyContent string) bool

func CreateKeyRecord

func CreateKeyRecord(keyContent string, keyName string, modelList []string, userName string, organizationName string,
	balance float64, requestPerMinute int, spendLimitPerWeek float64)

func CreateOrganizationRecord

func CreateOrganizationRecord(name string)

func CreateUserRecord

func CreateUserRecord(userName string, organizationName string)

func DeleteKeyRecord

func DeleteKeyRecord(keyContent string)

func DeleteOrganizationRecord

func DeleteOrganizationRecord(name string)

func DeleteUserRecord

func DeleteUserRecord(userName string)

func ToString

func ToString(s StringSlice) string

func UpdateOrganizationRecord

func UpdateOrganizationRecord(name string)

func UpdateUserRecord

func UpdateUserRecord(userName string, organizationName string)

Types

type Key

type Key struct {
	KeyId          int         `gorm:"primaryKey;column:key_id"`
	KeyContent     string      `gorm:"column:key_content"`
	KeyName        string      `gorm:"column:key_name"`
	ModelList      StringSlice `gorm:"column:model_list"`
	UserId         int         `gorm:"column:user_id"`
	OrganizationId int         `gorm:"column:organization_id"`

	Balance           float64 `gorm:"column:balance"`
	TotalSpend        float64 `gorm:"column:total_spend"`
	RequestPerMinute  int     `gorm:"column:request_per_minute"`   // 0 means unlimited
	SpendLimitPerWeek float64 `gorm:"column:spend_limit_per_week"` // 0 means unlimited

	CreateTime time.Time `gorm:"column:create_time"`
	ExpireTime time.Time `gorm:"column:expire_time"`
}

func GetAllValidKey

func GetAllValidKey() []Key

type Organization

type Organization struct {
	OrganizationId   int    `gorm:"primaryKey;column:organization_id"`
	OrganizationName string `gorm:"column:organization_name"`
}

func GetOrganizationRecord

func GetOrganizationRecord(name string) *Organization

type StringSlice

type StringSlice []string

func (*StringSlice) Scan

func (s *StringSlice) Scan(value interface{}) error

func (*StringSlice) Value

func (s *StringSlice) Value() (driver.Value, error)

type User

type User struct {
	UserId         int    `gorm:"primaryKey;column:user_id"`
	UserName       string `gorm:"column:user_name"`
	OrganizationId int    `gorm:"column:organization_id"`
}

func GetUserRecord

func GetUserRecord(userName string) *User

Jump to

Keyboard shortcuts

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