sfdb

package
v1.4.4-alpha1202-diff-... Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BatchAddGroupsForRules

func BatchAddGroupsForRules(db *gorm.DB, ruleNames, groupNames []string) (int64, error)

BatchAddGroupsForRules 为多个规则添加多个组 如果要添加的组不存在,会自动创建

func BatchAddGroupsForRulesByRuleId

func BatchAddGroupsForRulesByRuleId(db *gorm.DB, ruleIds, groupNames []string) (int64, error)

func BatchAddOrUpdateGroupsForRules

func BatchAddOrUpdateGroupsForRules(db *gorm.DB, ruleNames, groupNames []string) (int64, error)

BatchAddOrUpdateGroupsForRules 为多个规则添加多个组 如果要添加的组不存在,会自动创建

func BatchRemoveGroupsForRules

func BatchRemoveGroupsForRules(db *gorm.DB, ruleNames, groupNames []string) (int64, error)

BatchRemoveGroupsForRules 为多个规则移除多个组

func BatchRemoveGroupsForRulesById

func BatchRemoveGroupsForRulesById(db *gorm.DB, ruleIds, groupNames []string) (int64, error)

func BuildFileSystem

func BuildFileSystem(s *schema.SyntaxFlowRule) (fi.FileSystem, error)

已弃用

func CheckNewerVersion

func CheckNewerVersion(base, check string) bool

func CheckSyntaxFlowRuleContent

func CheckSyntaxFlowRuleContent(content string) (*schema.SyntaxFlowRule, error)

func CheckSyntaxFlowRuleType

func CheckSyntaxFlowRuleType(ruleName string) (schema.SyntaxFlowRuleType, error)

func CreateGroup

func CreateGroup(db *gorm.DB, groupName string, isBuildIn ...bool) (*schema.SyntaxFlowGroup, error)

CreateGroup 通过组名创建SyntaxFlow规则组

func CreateOrUpdateGroup

func CreateOrUpdateGroup(db *gorm.DB, groupName string, i *schema.SyntaxFlowGroup) (*schema.SyntaxFlowGroup, error)

func CreateOrUpdateGroups

func CreateOrUpdateGroups(db *gorm.DB, groupNames []string) []*schema.SyntaxFlowGroup

func CreateOrUpdateGroupsForRule

func CreateOrUpdateGroupsForRule(db *gorm.DB, rule *schema.SyntaxFlowRule, groups ...string) error

func CreateOrUpdateRuleWithGroup

func CreateOrUpdateRuleWithGroup(rule *schema.SyntaxFlowRule, groups ...string) (*schema.SyntaxFlowRule, error)

func CreateOrUpdateSyntaxFlowRule

func CreateOrUpdateSyntaxFlowRule(db *gorm.DB, RuleName string, i interface{}) error

func CreateRule

func CreateRule(rule *schema.SyntaxFlowRule, groups ...string) (*schema.SyntaxFlowRule, error)

func CreateRuleByContent

func CreateRuleByContent(ruleFileName string, content string, buildIn bool, tags ...string) (*schema.SyntaxFlowRule, error)

func CreateRuleWithDefaultGroup

func CreateRuleWithDefaultGroup(rule *schema.SyntaxFlowRule, groups ...string) (*schema.SyntaxFlowRule, error)

func DeleteBuildInRule

func DeleteBuildInRule() error

func DeleteGroup

func DeleteGroup(db *gorm.DB, groupName string) error

DeleteGroup 通过组名删除SyntaxFlow规则组

func DeleteRuleByLibName

func DeleteRuleByLibName(name string) error

func DeleteRuleByRuleName

func DeleteRuleByRuleName(name string) error

func DeleteRuleByTitle

func DeleteRuleByTitle(name string) error

func DeleteSyntaxFlowRuleByRuleNameOrRuleId

func DeleteSyntaxFlowRuleByRuleNameOrRuleId(name, ruleId string) error

func ExportDatabase

func ExportDatabase() io.ReadCloser

func GetIntersectionGroup

func GetIntersectionGroup(db *gorm.DB, groups [][]*schema.SyntaxFlowGroup) []*schema.SyntaxFlowGroup

func GetLibrary

func GetLibrary(libname string) (*schema.SyntaxFlowRule, error)

func GetOrCreateGroups

func GetOrCreateGroups(db *gorm.DB, groupNames []string) []*schema.SyntaxFlowGroup

func GetRule

func GetRule(ruleName string) (*schema.SyntaxFlowRule, error)

func GetRuleByLanguage

func GetRuleByLanguage(language string) ([]*schema.SyntaxFlowRule, error)

func GetRulePure

func GetRulePure(ruleName string) (*schema.SyntaxFlowRule, error)

func GetRules

func GetRules(ruleNameGlob string) ([]*schema.SyntaxFlowRule, error)

func GetVersionFromEmbed

func GetVersionFromEmbed(ruleId string) (string, error)

func ImportDatabase

func ImportDatabase(reader io.Reader) error

func ImportRuleWithoutValid

func ImportRuleWithoutValid(ruleName string, content string, buildin bool, tags ...string) (*schema.SyntaxFlowRule, error)

func ImportValidRule

func ImportValidRule(system fi.FileSystem, ruleName string, content string) error

func LoadFileSystem

func LoadFileSystem(s *schema.SyntaxFlowRule, system fi.FileSystem) error

已弃用

func MigrateSyntaxFlow

func MigrateSyntaxFlow(hash string, i *schema.SyntaxFlowRule) error

func QueryGroupByName

func QueryGroupByName(db *gorm.DB, groupName string) (*schema.SyntaxFlowGroup, error)

QueryGroupByName 根据组名查询组

func QueryGroupByRuleIds

func QueryGroupByRuleIds(db *gorm.DB, RuleIds []string) ([]*schema.SyntaxFlowGroup, error)

func QueryGroupsByName

func QueryGroupsByName(db *gorm.DB, groupNames []string) ([]*schema.SyntaxFlowGroup, error)

func QueryRuleByLanguage

func QueryRuleByLanguage(db *gorm.DB, language ssaconfig.Language) ([]*schema.SyntaxFlowRule, error)

func QueryRuleByName

func QueryRuleByName(db *gorm.DB, ruleName string) (*schema.SyntaxFlowRule, error)

func QueryRuleByRuleId

func QueryRuleByRuleId(db *gorm.DB, ruleId string) (*schema.SyntaxFlowRule, error)

func QueryRulesById

func QueryRulesById(db *gorm.DB, ruleIds []string) ([]*schema.SyntaxFlowRule, error)

func QueryRulesByName

func QueryRulesByName(db *gorm.DB, ruleNames []string) ([]*schema.SyntaxFlowRule, error)

func RegisterValid

func RegisterValid(f func(rule *schema.SyntaxFlowRule) error)

func RenameGroup

func RenameGroup(db *gorm.DB, oldName, newName string) error

RenameGroup 重命名组

func UpdateRule

func UpdateRule(db *gorm.DB, rule *schema.SyntaxFlowRule) error

func UpdateVersion

func UpdateVersion(existingVersion string) string

func YieldBuildInSyntaxFlowRules

func YieldBuildInSyntaxFlowRules(db *gorm.DB, ctx context.Context) chan *schema.SyntaxFlowRule

func YieldSyntaxFlowRules

func YieldSyntaxFlowRules(db *gorm.DB, ctx context.Context) chan *schema.SyntaxFlowRule

func YieldSyntaxFlowRulesWithoutLib

func YieldSyntaxFlowRulesWithoutLib(db *gorm.DB, ctx context.Context) chan *schema.SyntaxFlowRule

Types

type RuleInfo

type RuleInfo struct {
	RuleID   string `json:"rule_id"`
	RuleName string `json:"rule_name"`
	Hash     string `json:"hash"`
	Version  string `json:"version"`
}

func EmbedRuleVersion

func EmbedRuleVersion() []RuleInfo

func GetRuleInfo

func GetRuleInfo(ruleId string) (*RuleInfo, error)

Jump to

Keyboard shortcuts

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