registerviews

package module
v0.0.0-...-a5c7bd3 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2020 License: MIT Imports: 7 Imported by: 2

README

qor-registerviews

qor-registerviews

用于解决在 go mod 模式下使用 qor-admin 框架开发,相关组件视图注册失败的问题。

可以返回指定依赖包的指定文件夹路径

使用方法
package main

import (
"fmt"


registerviews "github.com/snowlyg/qor-registerviews"
	
)

func main() {
	
    path := registerviews.DetectViewsDir("github.com/snowlyg", "go-tenancy", "config") 
    fmt.Println(path)
}

详情见项目 snowlyg/go-tenancy

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectViewsDir

func DetectViewsDir(pkgorg, pkgname, subpath string) string

DetectViewsDir 解决 go mod 模式无法注册 qor-admin 等包的 views 如果 pkgname 和 subpath 都是空字符,则检查 pkgorg 是否是绝对路径, 同时会在 $gopath/src, vendor, 等目录下循环检查 pkgorg 项目是否存在。 否则会在 $gopath/pkg/mod/ 目录下(go mod 模式) pkgorg+pkgname+subpath (subpath 为空字符则会默认为 views ,默认会视图目录) 路径是否存在, 如果需要检查非 views 目录例如 */*/views 或者 user/theme/local ,则需要设置 subpath 为 */*/views 或者 user/theme/local 。 只要检查存在目录就会返回相关路径

Types

This section is empty.

Jump to

Keyboard shortcuts

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