docProjects

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExistsBySlug

func ExistsBySlug(slug string) bool

ExistsBySlug 检查slug是否存在

func ExistsBySlugExcludeId

func ExistsBySlugExcludeId(slug string, excludeId uint64) bool

ExistsBySlugExcludeId 检查slug是否存在(排除指定ID)

func SaveOrCreateById

func SaveOrCreateById(entity *Entity) int64

func SoftDelete

func SoftDelete(entity *Entity) int64

SoftDelete 软删除

Types

type Entity

type Entity struct {
	Id          uint64 `gorm:"primaryKey;column:id;autoIncrement;not null;" json:"id"`                  // 项目ID
	Name        string `gorm:"column:name;type:varchar(100);not null;default:'';" json:"name"`          // 项目名称
	Slug        string `gorm:"column:slug;type:varchar(100);not null;default:'';" json:"slug"`          // 项目标识符
	Description string `gorm:"column:description;type:text;" json:"description"`                        // 项目描述
	LogoUrl     string `gorm:"column:logo_url;type:varchar(255);not null;default:'';" json:"logoUrl"`   // 项目Logo
	Status      int8   `gorm:"column:status;type:tinyint;not null;default:1;" json:"status"`            // 状态(1:活跃 2:维护 3:废弃)
	IsPublic    int8   `gorm:"column:is_public;type:tinyint;not null;default:1;" json:"isPublic"`       // 是否公开(0:私有 1:公开)
	OwnerId     uint64 `gorm:"column:owner_id;type:bigint unsigned;not null;default:0;" json:"ownerId"` // 项目所有者ID

	CreatedAt time.Time      `gorm:"column:created_at;index;autoCreateTime;<-:create;" json:"createdAt"` // 创建时间
	UpdatedAt time.Time      `gorm:"column:updated_at;autoUpdateTime;" json:"updatedAt"`                 // 更新时间
	DeletedAt gorm.DeletedAt // 删除时间
}

func Get

func Get(id any) (entity Entity)

func GetAllActive

func GetAllActive() (entities []Entity)

GetAllActive 获取所有活跃项目

func GetByOwnerId

func GetByOwnerId(ownerId uint64) (entities []Entity)

GetByOwnerId 根据所有者ID获取项目列表

func GetBySlug

func GetBySlug(slug string) (entity Entity)

GetBySlug 根据slug获取项目

func GetProjectList

func GetProjectList(page, pageSize int, keyword string, status *int8, isPublic *int8) ([]Entity, int64, error)

GetProjectList 分页查询项目列表

func (*Entity) TableName

func (itself *Entity) TableName() string

Jump to

Keyboard shortcuts

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