Documentation
¶
Index ¶
- Constants
- func FindProjectRoot() (string, error)
- func GenerateAPI(authCfg *AuthConfig)
- func GenerateAPIWithSkip(authCfg *AuthConfig, resourcesToSkip map[string]bool)
- func GenerateOpenAPI(tables map[string]TableSchema)
- func GenerateStructs(tables map[string]TableSchema)
- func GetConfigPath(cfg *config.Config) (string, error)
- func GetDTOsPath(cfg *config.Config) (string, error)
- func GetModelsPath(cfg *config.Config) (string, error)
- func GetOpenAPIPath(cfg *config.Config) (string, error)
- func GetResourcesPath(cfg *config.Config) (string, error)
- func GetRoutesPath(cfg *config.Config) (string, error)
- func GoTypeToOpenAPIType(goType string) (string, string)
- func LoadConfig() (*config.Config, error)
- func LoadResourceDTOs() map[string]ResourceDTOs
- func LoadSchema(db database.Database) map[string]TableSchema
- func Pluralize(word string) string
- func ScaffoldAll(db database.Database)
- func SingularizeExported(word string) string
- type AuthConfig
- type Column
- type DTOSchema
- type Relation
- type ResourceDTOs
- type StructField
- type TableSchema
Constants ¶
View Source
const ( FieldID = "id" FieldCreatedAt = "created_at" FieldUpdatedAt = "updated_at" )
View Source
const ( DefaultPageSize = 20 MaxPageSize = 1000 MinPageSize = 1 )
Variables ¶
This section is empty.
Functions ¶
func FindProjectRoot ¶
func GenerateAPI ¶
func GenerateAPI(authCfg *AuthConfig)
func GenerateAPIWithSkip ¶
func GenerateAPIWithSkip(authCfg *AuthConfig, resourcesToSkip map[string]bool)
func GenerateOpenAPI ¶
func GenerateOpenAPI(tables map[string]TableSchema)
func GenerateStructs ¶
func GenerateStructs(tables map[string]TableSchema)
func GoTypeToOpenAPIType ¶
func LoadConfig ¶
func LoadResourceDTOs ¶
func LoadResourceDTOs() map[string]ResourceDTOs
func LoadSchema ¶
func LoadSchema(db database.Database) map[string]TableSchema
func ScaffoldAll ¶
func SingularizeExported ¶
Types ¶
type AuthConfig ¶
type AuthConfig struct {
Enabled bool // Whether auth is enabled globally
RequireAuth map[string][]string // resource -> HTTP methods requiring auth
}
AuthConfig defines which endpoints require authentication This is now derived from the unified config.Config
func DefaultAuthConfig ¶
func DefaultAuthConfig() *AuthConfig
DefaultAuthConfig returns a configuration that requires auth for all CRUD operations This is kept for backwards compatibility with tests
func GetAuthConfigFromConfig ¶
func GetAuthConfigFromConfig(cfg *config.Config) *AuthConfig
GetAuthConfigFromConfig creates an AuthConfig from the unified config
func NoAuthConfig ¶
func NoAuthConfig() *AuthConfig
NoAuthConfig returns a configuration with no authentication requirements This is kept for backwards compatibility with tests
func (*AuthConfig) RequiresAuth ¶
func (c *AuthConfig) RequiresAuth(resource, method string) bool
RequiresAuth checks if a specific resource and HTTP method requires authentication
func (*AuthConfig) SetResourceAuth ¶
func (c *AuthConfig) SetResourceAuth(resource string, methods []string)
SetResourceAuth sets the authentication requirements for a resource
type DTOSchema ¶
type DTOSchema struct {
Name string
Fields []StructField
}
type ResourceDTOs ¶
func (*ResourceDTOs) GetMainDTO ¶
func (r *ResourceDTOs) GetMainDTO() *DTOSchema
type StructField ¶
type TableSchema ¶
Click to show internal directories.
Click to hide internal directories.