Skip to content

Conversation

MJacred
Copy link
Contributor

@MJacred MJacred commented Jul 24, 2024

Example table

CREATE TABLE IF NOT EXISTS `Slash/Test` (
    id INT UNSIGNED NOT NULL AUTO_INCREMENT,

    `my_en/um` ENUM('test/1', '/test2', 'test3'),

    PRIMARY KEY (id)
);

Sqlboiler attempts to create a file called "Slash/Test.go", which it fails to do - and should not do. This fix changes the output to "Slash_Test.go".

NOTE: this output also requires aarondl/strmangle#17 and aarondl/strmangle#18

// SlashTest is an object representing the database table.
type SlashTest struct {
	ID     uint                `csv:"id" hash:"id" boil:"id" json:"id" toml:"id" yaml:"id"`
	MyEnUm SlashTestNullMyEnUm `csv:"my_en/um" hash:"my_en/um" boil:"my_en/um" json:"my_en/um,omitempty" toml:"my_en/um" yaml:"my_en/um,omitempty"`

	R *slashTestR `csv:"-" hash:"-" boil:"-" json:"-" toml:"-" yaml:"-"`
	L slashTestL  `csv:"-" hash:"-" boil:"-" json:"-" toml:"-" yaml:"-"`
}

// and in boil_types.go

type SlashTestMyEnUm string

// Enum values for SlashTestMyEnUm
const (
	SlashTestMyEnUmTest1 SlashTestMyEnUm = "test/1"
	SlashTestMyEnUmTest2 SlashTestMyEnUm = "/test2"
	SlashTestMyEnUmTest3 SlashTestMyEnUm = "test3"
)

@MJacred
Copy link
Contributor Author

MJacred commented Jul 24, 2024

@stephenafamo: This PR together with aarondl/strmangle#18 would add support for table names containing slashes

@stephenafamo stephenafamo merged commit 9eaa10e into aarondl:master Oct 23, 2024
@MJacred MJacred deleted the fix_filename_gen branch October 23, 2024 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants