docs: add comprehensive godoc comments to core API#28
Merged
AWaterColorPen merged 1 commit intomainfrom Apr 14, 2026
Merged
Conversation
Add a new doc.go package-level overview and enrich all core files with godoc comments: - doc.go: package overview with key concepts and quick-start example - schema.go: User, Role, Object, Domain, Policy, Directory, and related types - metadata.go: MetaDB, UpsertType interface and all method docs - constant.go: all constants (ObjectPType, actions, directory search types, etc.) - error.go: all sentinel errors with usage guidance - options.go: Options, Option, DefaultSuperadmin* vars - register.go: Factory, Register, DefaultFactory and helper funcs - inheritance.go: InheritanceEdge, EdgeSorter, InheritanceGraph and methods - casbin.go: IEnforcer (all methods), SetWatcher, WatcherOption, NewEnforcer - schema_buildin.go: NamedObject, SampleSuperadminRole/Domain, GetSuperadmin* - dictionary.go: IDictionary, IFeatureDictionary, ICreatorDictionary - metadata_database.go: DBOption All existing tests pass (go test ./...).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds comprehensive godoc comments to the core API files as part of Phase 1 – Foundation Modernization (Task 1.3 in the modernization plan).
Changes
User,Role,Object,Domain,Policy,Directory,DirectoryRequest/Responseand all related typesMetaDBinterface and all method signatures with parameter/return docsObjectPType,Read/Write/Manage,DirectorySearchAll/Top,UpsertType*)errors.Isusage exampleOptions,Optionfunctional type,DefaultSuperadmin*varsFactory,Register[U,R,O,D],DefaultFactoryand unexported helpersInheritanceEdge,EdgeSorter,InheritanceGraphand all methodsIEnforcer(all 28 method docs),SetWatcher,WatcherOption,NewEnforcerNamedObject,SampleSuperadminRole/Domain,GetSuperadmin*IDictionary,IFeatureDictionary,ICreatorDictionaryDBOptionand itsNewDBmethodTesting
All existing tests pass (
go test ./...).Part of
Phase 1 – Foundation Modernization, Task 1.3: Enrich godoc on core public API