Versions in this module Expand all Collapse all v0 v0.19.4 May 24, 2023 Changes in this version + const DefaultMaxInSize + const NoConditionID + var AlphaDashDotPattern = regexp.MustCompile(`[^\w-\.]`) + var DefaultContext context.Context + var ErrGetResourceIndexFailed = errors.New("get resource index failed") + var ErrNameEmpty = util.SilentWrap + var ErrResouceOutdated = errors.New("resource outdated") + var HasEngine bool + func BuildCaseInsensitiveLike(key, value string) builder.Cond + func Cell2Int64(val xorm.Cell) int64 + func ConvertUtf8ToUtf8mb4() error + func ConvertVarcharToNVarchar() error + func Count(ctx context.Context, opts FindOptions, object T) (int64, error) + func CountBadSequences(_ context.Context) (int64, error) + func CountByBean(ctx context.Context, bean interface{}) (int64, error) + func CountOrphanedObjects(ctx context.Context, subject, refobject, joinCond string) (int64, error) + func DecrByIDs(ctx context.Context, ids []int64, decrCol string, bean interface{}) error + func DeleteAllRecords(tableName string) error + func DeleteBeans(ctx context.Context, beans ...interface{}) (err error) + func DeleteByBean(ctx context.Context, bean interface{}) (int64, error) + func DeleteByID(ctx context.Context, id int64, bean interface{}) (int64, error) + func DeleteOrphanedObjects(ctx context.Context, subject, refobject, joinCond string) error + func DeleteResourceIndex(ctx context.Context, tableName string, groupID int64) error + func DumpDatabase(filePath, dbType string) error + func DumpTables(tables []*schemas.Table, w io.Writer, tp ...schemas.DBType) error + func ErrCancelledf(format string, args ...interface{}) error + func EstimateCount(ctx context.Context, bean interface{}) (int64, error) + func Exec(ctx context.Context, sqlAndArgs ...interface{}) (sql.Result, error) + func Find(ctx context.Context, opts FindOptions, objects *[]T) error + func FindAndCount(ctx context.Context, opts FindOptions, objects *[]T) (int64, error) + func FindIDs(ctx context.Context, tableName, idCol string, cond builder.Cond) ([]int64, error) + func FixBadSequences(_ context.Context) error + func GetByBean(ctx context.Context, bean interface{}) (bool, error) + func GetMaxID(beanOrTableName interface{}) (maxID int64, err error) + func GetNextResourceIndex(ctx context.Context, tableName string, groupID int64) (int64, error) + func GetPaginatedSession(p Paginator) *xorm.Session + func InTransaction(ctx context.Context) bool + func InitEngine(ctx context.Context) error + func InitEngineWithMigration(ctx context.Context, migrateFunc func(*xorm.Engine) error) (err error) + func Insert(ctx context.Context, beans ...interface{}) error + func IsErrCancelled(err error) bool + func IsErrNameCharsNotAllowed(err error) bool + func IsErrNamePatternNotAllowed(err error) bool + func IsErrNameReserved(err error) bool + func IsErrNotExist(err error) bool + func IsErrSSHDisabled(err error) bool + func IsTableNotEmpty(tableName string) (bool, error) + func IsUsableName(names, patterns []string, name string) error + func Iterate(ctx context.Context, cond builder.Cond, ...) error + func MaxBatchInsertSize(bean interface{}) int + func NamesToBean(names ...string) ([]interface{}, error) + func NewXORMLogger(showSQL bool) xormlog.Logger + func RegisterModel(bean interface{}, initFunc ...func() error) + func SetDefaultEngine(ctx context.Context, eng *xorm.Engine) + func SetLogSQL(ctx context.Context, on bool) + func SetSessionPagination(sess Engine, p Paginator) *xorm.Session + func SyncAllTables() error + func SyncMaxResourceIndex(ctx context.Context, tableName string, groupID, maxIndex int64) (err error) + func TableInfo(v interface{}) (*schemas.Table, error) + func TableName(bean interface{}) string + func TruncateBeans(ctx context.Context, beans ...interface{}) (err error) + func TxContext(parentCtx context.Context) (*Context, Committer, error) + func UnsetDefaultEngine() + func WithTx(parentCtx context.Context, f func(ctx context.Context) error) error + type AbsoluteListOptions struct + func NewAbsoluteListOptions(skip, take int) *AbsoluteListOptions + func (opts *AbsoluteListOptions) GetSkipTake() (skip, take int) + func (opts *AbsoluteListOptions) GetStartEnd() (start, end int) + func (opts *AbsoluteListOptions) IsListAll() bool + type Committer interface + Close func() error + Commit func() error + type Context struct + func (ctx *Context) Engine() Engine + func (ctx *Context) InTransaction() bool + func (ctx *Context) Value(key interface{}) interface{} + func (ctx *Context) WithContext(other context.Context) *Context + type Engine interface + Asc func(colNames ...string) *xorm.Session + Cols func(...string) *xorm.Session + Context func(ctx context.Context) *xorm.Session + Count func(...interface{}) (int64, error) + Decr func(column string, arg ...interface{}) *xorm.Session + Delete func(...interface{}) (int64, error) + Desc func(colNames ...string) *xorm.Session + Distinct func(...string) *xorm.Session + Exec func(...interface{}) (sql.Result, error) + Exist func(...interface{}) (bool, error) + Find func(interface{}, ...interface{}) error + Get func(beans ...interface{}) (bool, error) + ID func(interface{}) *xorm.Session + In func(string, ...interface{}) *xorm.Session + Incr func(column string, arg ...interface{}) *xorm.Session + Insert func(...interface{}) (int64, error) + Iterate func(interface{}, xorm.IterFunc) error + Join func(joinOperator string, tablename, condition interface{}, args ...interface{}) *xorm.Session + Limit func(limit int, start ...int) *xorm.Session + NoAutoTime func() *xorm.Session + NotIn func(string, ...interface{}) *xorm.Session + OrderBy func(interface{}, ...interface{}) *xorm.Session + Ping func() error + Query func(...interface{}) ([]map[string][]byte, error) + SQL func(interface{}, ...interface{}) *xorm.Session + Select func(string) *xorm.Session + SumInt func(bean interface{}, columnName string) (res int64, err error) + Sync2 func(...interface{}) error + Table func(tableNameOrBean interface{}) *xorm.Session + Truncate func(...interface{}) (int64, error) + Where func(interface{}, ...interface{}) *xorm.Session + func GetEngine(ctx context.Context) Engine + func SetEnginePagination(e Engine, p Paginator) Engine + type Engined interface + Engine func() Engine + type ErrCancelled struct + Message string + func (err ErrCancelled) Error() string + type ErrNameCharsNotAllowed struct + Name string + func (err ErrNameCharsNotAllowed) Error() string + func (err ErrNameCharsNotAllowed) Unwrap() error + type ErrNamePatternNotAllowed struct + Pattern string + func (err ErrNamePatternNotAllowed) Error() string + func (err ErrNamePatternNotAllowed) Unwrap() error + type ErrNameReserved struct + Name string + func (err ErrNameReserved) Error() string + func (err ErrNameReserved) Unwrap() error + type ErrNotExist struct + ID int64 + Resource string + func (err ErrNotExist) Error() string + func (err ErrNotExist) Unwrap() error + type ErrSSHDisabled struct + func (err ErrSSHDisabled) Error() string + type FindOptions interface + ToConds func() builder.Cond + type ListOptions struct + ListAll bool + Page int + PageSize int + func (opts *ListOptions) GetSkipTake() (skip, take int) + func (opts *ListOptions) GetStartEnd() (start, end int) + func (opts *ListOptions) IsListAll() bool + func (opts *ListOptions) SetDefaultValues() + type Paginator interface + GetSkipTake func() (skip, take int) + GetStartEnd func() (start, end int) + IsListAll func() bool + type ResourceIndex struct + GroupID int64 + MaxIndex int64 + type SearchOrderBy string + const SearchOrderByAlphabetically + const SearchOrderByAlphabeticallyReverse + const SearchOrderByForks + const SearchOrderByForksReverse + const SearchOrderByID + const SearchOrderByIDReverse + const SearchOrderByLeastUpdated + const SearchOrderByNewest + const SearchOrderByOldest + const SearchOrderByRecentUpdated + const SearchOrderBySize + const SearchOrderBySizeReverse + const SearchOrderByStars + const SearchOrderByStarsReverse + func (s SearchOrderBy) String() string + type XORMLogBridge struct + func (l *XORMLogBridge) Debug(v ...interface{}) + func (l *XORMLogBridge) Debugf(format string, v ...interface{}) + func (l *XORMLogBridge) Error(v ...interface{}) + func (l *XORMLogBridge) Errorf(format string, v ...interface{}) + func (l *XORMLogBridge) Info(v ...interface{}) + func (l *XORMLogBridge) Infof(format string, v ...interface{}) + func (l *XORMLogBridge) IsShowSQL() bool + func (l *XORMLogBridge) Level() xormlog.LogLevel + func (l *XORMLogBridge) Log(skip int, level log.Level, format string, v ...interface{}) + func (l *XORMLogBridge) SetLevel(lvl xormlog.LogLevel) + func (l *XORMLogBridge) ShowSQL(show ...bool) + func (l *XORMLogBridge) Warn(v ...interface{}) + func (l *XORMLogBridge) Warnf(format string, v ...interface{})